nsbin/linux/t_rmmod_modprobe_loop.sh

22 lines
346 B
Bash
Raw Normal View History

2009-03-12 15:08:50 +00:00
#!/bin/sh
# Nico Schottelius
# Script to test if a module can be reloaded
# usage: <module> <cmd>
# example: iwlagn "sleep 0.2"
2009-03-12 15:08:50 +00:00
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
2009-03-12 15:08:50 +00:00
done