?
Solved

How do you setup an automation script for modprobe?

Posted on 2007-11-20
10
Medium Priority
?
828 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
[X]
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
  • 6
  • 4
10 Comments
 
LVL 35

Expert Comment

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

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

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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 35

Accepted Solution

by:
Duncan Roe earned 2000 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 35

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

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

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.
This program is used to assist in finding and resolving common problems with wireless connections.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month8 days, 4 hours left to enroll

765 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