Solved

How do you setup an automation script for modprobe?

Posted on 2007-11-20
10
819 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 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

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.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

690 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