#!/bin/sh # # ipw3945d This shell script takes care of starting and stopping # the IPW3945 regulatory daemon # # chkconfig: 345 9 91 # description: The IPW3945 regulatory daemon is required for use of the # ipw3945 wireless NIC driver. # # Source function library. . /etc/rc.d/init.d/functions prog="ipw3945d" start() { # Load module and start daemon echo -n $"Starting $prog: " /sbin/modprobe ipw3945 2>/dev/null for ((count=0; count<20; count++)); do if [ ! -e /sys/bus/pci/drivers/ipw3945/*/cmd ]; then sleep 0.5 else break fi done [ $count -eq 20 ] && return 1 daemon /sbin/ipw3945d --quiet 2>/dev/null RETVAL=$? for ((count=0; count<20; count++)); do if [ ! -e /sys/bus/pci/drivers/ipw3945/*/net:* ]; then sleep 0.5 else break fi done [ $count -eq 20 ] && return 1 echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ipw3945d return $RETVAL } stop() { # Stop service. echo -n $"Shutting down $prog: " killproc ipw3945d RETVAL=$? echo if [ $RETVAL -eq 0 ]; then rm -f /var/lock/subsys/ipw3945d /sbin/modprobe -r ipw3945 2>/dev/null fi return $RETVAL } [ -f /sbin/ipw3945d ] || exit 0 # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status ipw3945d RETVAL=$? ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/ipw3945d ]; then stop start RETVAL=$? fi ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" exit 1 esac exit $RETVAL