Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How do you setup an automation script for modprobe?

Posted on 2007-11-20
10
793 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
home router to use as repeater  (signal extender) 10 34
SonarQube on Linux vs Windows 3 51
Issue with Cisco 4402 and 1142 LAPs 1 23
Testing my WiFi 13 49
Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

809 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