Solved

How do you setup an automation script for modprobe?

Posted on 2007-11-20
10
760 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dual Band Channels 7 33
Anti-Spam SMTP Proxy Server (@SSP) 7 47
Problem to start Neon 20 54
Linux as a middle box 7 25
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now