nsbin/linux/t_rmmod_modprobe_loop.sh
2009-03-12 16:12:37 +01:00

21 lines
346 B
Bash
Executable file

#!/bin/sh
# Nico Schottelius
# Script to test if a module can be reloaded
# usage: <module> <cmd>
# example: iwlagn "sleep 0.2"
mod="$1"; shift
cmd="$1"; shift
while true; do
loaded=$(lsmod | grep ^${mod})
if [ "$loaded" ]; then
rmmod -v "$mod"
else
modprobe -v "$mod"
fi
echo "Calling $cmd ..."
eval $cmd
done