Re: Simple Shell Script



On Tue, 27 Feb 2007 13:39:47 +0900, Dan N wrote:

I need a script to insmod a module if lsmod doesn't list it. How would I
go about doing that? I know it would be pretty simple.

You might want to read http://tldp.org/LDP/abs/html/index.html and do a

man grep
man test

----- starter script follows --------------------

_count=$(grep -c mod_name_here lsmod)

if [ $_count -eq 0 ] ; then
(your insmod command here)
if [ $? -ne 0 ] ; then
mail -s "insmod whatever failed" dan@xxxxxxxxxxxxxxxxxxx < /dev/null
fi
fi
.



Relevant Pages

  • Re: insmod problem
    ... I'm trying to setup iptables and ... > when I exicute the script I get these errors... ... > insmod ipt_REJECT ... Fedora GNU/Linux Core 2 kernel 2.6.8-1.521smp ...
    (Fedora)
  • Re: Novell emulator
    ... starting Netware Emulation marsnwe ... Looking at 'man insmod', ... The Copyright line in the script says 1995-2001 so I'd guess that this ...
    (alt.os.linux.suse)
  • Re: insmod problem
    ... > I setup FC2 on an old Dell Dimention computer I had laying around and ... > when I exicute the script I get these errors... ... > insmod ipt_REJECT ... Don't use insmod, use modprobe. ...
    (Fedora)
  • Re: Novell emulator
    ... The BACKWARDS COMPATIBILITY section also says: ... This version of insmod is for kernels 2.5.48 and above. ... The Copyright line in the script says 1995-2001 so I'd guess that this ...
    (alt.os.linux.suse)
  • Re: Simple Shell Question
    ... > In my bash shell script, I attempt to install a driver as follows: ... > When I execute the script, insmod is invoked but the script can't find ... > If I run the insmod command directly in the shell, ...
    (comp.unix.shell)