2009-03-12 15:08:50 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Nico Schottelius
|
|
|
|
# Script to test if a module can be reloaded
|
2009-03-12 15:12:37 +00:00
|
|
|
# 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
|
2009-03-12 15:12:37 +00:00
|
|
|
echo "Calling $cmd ..."
|
|
|
|
eval $cmd
|
2009-03-12 15:08:50 +00:00
|
|
|
done
|
|
|
|
|