add script to load and unload module

This commit is contained in:
Nico Schottelius 2009-03-12 16:08:50 +01:00
parent ec746f51ab
commit 388077ca79
1 changed files with 19 additions and 0 deletions

19
linux/t_rmmod_modprobe_loop.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# Nico Schottelius
# Script to test if a module can be reloaded
mod="$1"; shift
cmd="$1"; shift
while true; do
loaded=$(lsmod | grep ^${mod})
if [ "$loaded" ]; then
rmmod -v "$mod"
else
modprobe -v "$mod"
fi
$cmd
done