Solved

How do you setup an automation script for modprobe?

Posted on 2007-11-20
10
783 Views
Last Modified: 2012-05-05
I am trying to setup an automation script to load a wireless driver using the following command:
I put the following commands in /etc/modprobe.d/iwp3945

echo install ipw3945 /sbin/modprobe --ignore-install ipw3945 ; \
sleep 0.5 ; /sbin/ipw3945d --quiet >> /etc/modules.d/ipw3945
 echo remove ipw3945  /sbin/ipw3945d --kill ; \
/sbin/modprobe -r --ignore-remove ipw3945 >> /etc/modules.d/ipw3945

modprobe returns the following warning: ignoring bad line starting with echo. What is the correct syntax to get this script to work?
0
Comment
Question by:marcus_carey
  • 6
  • 4
10 Comments
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 20326731
Looks like you're missing a semicolon:

echo install ipw3945; /sbin/modprobe --ignore-install ipw3945 ; \
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 20326736
Also

echo remove ipw3945;  /sbin/ipw3945d --kill ; \
0
 

Author Comment

by:marcus_carey
ID: 20327287
Putting a semicolon after the first command did not work.  I am still getting the warning.

WARNING: /etc/modprobe.d/ipw3945 line: 1: ignoring bad line beginning with 'echo'
WARNING: /etc/modprobe.d/ipw3945 line: 2: ignoring bad line beginning with 'echo'
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 total points
ID: 20331163
What else have you got in /etc/modprobe.d? It doesn't look to me like a directory where you should have scripts at all:

08:30:21$ ls -l /etc/modprobe.d  
total 12
-rw-r--r--  1 root root 6337 2007-05-19 16:11 blacklist
-rw-r--r--  1 root root  356 2007-05-18 07:16 isapnp
0
 

Author Comment

by:marcus_carey
ID: 20334567
The problem with the file format. The file was saved using the dos format.  Once I corrected this it worked.
0
 

Author Comment

by:marcus_carey
ID: 20335342
Ignore my last comment, it refers to a different file.  I did copy the initialization file to the wrong directory.  The correct directory is modules.d but the script still does not work.

/etc/modules.d/ipw3945:

 echo install ipw3945 /sbin/modprobe --ignore-install ipw3945 ; \
sleep 0.5 ; /sbin/ipw3945d --quiet >> /etc/modules.d/ipw3945

 echo remove ipw3945  /sbin/ipw3945d --kill ; \
/sbin/modprobe -r --ignore-remove ipw3945 >> /etc/modules.d/ipw3945

      # modprobe ipw3945 <-- This command should load the module but it does not.
      # ps -C ipw3945d     <-- This command does not show the process
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 20336020
You *do* have to insert the semicolons that I mentioned earlier:

 echo install ipw3945; /sbin/modprobe --ignore-install ipw3945 ; \

and

 echo install ipw3945; /sbin/modprobe --ignore-install ipw3945 ; \
0
 

Author Comment

by:marcus_carey
ID: 20336499
It still does not work.  But after doing a dostounix format I don't get the warning.  

Instead of using modprobe to load the module I put an initialization script in /etc/init.d.  The script loads the module but this prevents the network manager from starting.

#!/bin/sh
#
# ipw3945d:     Intel Pro Wireless 3945ABG Wireless Daemon
#
# chkconfig: 2345 90 10
# description: Activates/Deactivates eth1 wireless interface (ipw3945)
#
# processname: ipw3945d
# pidfile: /var/run/ipw3945d/ipw3945d.pid
#
 
prefix=/usr
exec_prefix=/usr
sbindir=/sbin
 
IPW3945D_BIN=${sbindir}/ipw3945d
 
# Sanity checks
[ -x $IPW3945D_BIN ] || exit 1
 
# Source function library.
. /etc/rc.d/init.d/functions
 
# so we can rearrange this easily
processname=ipw3945d
servicename=ipw3945d
pidfile=/var/run/ipw3945d.pid
 
RETVAL=0
 
start()
{
        echo -n $"Starting Intel Pro Wireless 3945ABG daemon: "
        daemon --check $servicename $processname --pid-file=$pidfile
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
}
 
stop()
{
        echo -n $"Stopping Intel Pro Wireless 3945ABG daemon: "
        killproc -p $pidfile $servicename
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
                rm -f /var/lock/subsys/$servicename
                rm -f $pidfile
        fi
}
 
 
 
# See how we were called.
case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        status)
                status -p $pidfile $processname
                RETVAL=$?
                ;;
        restart)
                stop
                start
                ;;
        condrestart)
                if [ -f /var/lock/subsys/$servicename ]; then
                        stop
                        start
                fi
                ;;
        *)
                echo $"Usage: $0 {start|stop|status|restart|condrestart}"
                ;;
esac
exit $RETVAL


#! /bin/bash
#
# network       Bring up/down networking
#
# chkconfig: 2345 10 90
# description: Activates/Deactivates all network interfaces configured to \
#              start at boot time.
#
### BEGIN INIT INFO
# Provides: $network
# Should-Start: iptables ip6tables
### END INIT INFO

# chkconfig: 2345 10 90 <-- Network interface
# chkconfig: 2345 90 10  <-- Wireless daemon
0
 

Author Comment

by:marcus_carey
ID: 20336943
I got it to work by changing the chkconfig values for ipw3945 script.

#checkconfig: 2345 98 10 <-- Wireless daemon
#checkconfig        - 92 2  <-- Network Manager

0
 

Author Closing Comment

by:marcus_carey
ID: 31410309
I solved this problem myself but the information duncan roe provided was useful.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This subject  of securing wireless devices conjures up visions of your PC or mobile phone connecting to the Internet through some hotspot at Starbucks. But it is so much more than that. Let’s look at the facts: devices#sthash.eoFY7dic.
DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question