Feel free to adjust this to suit your needs, then put it in /etc/rc.d, make it executable and run it from within /etc/rc.d/network by adding this line to it : cgs-zd1211_control start
Good Luck
-
#! /bin/bash
# wireless activate wireless lan
#
# chkconfig: - 07 93
# description: starts the wireless lan
#
# created 04 June 03
# by George Nimmer
george164@earthlink.net
# *******************************************************************************************
# *---> PATCHED ON 15 juli 2005 by ph0b0s (d4rkritu4l@gmail.com) for the Zydas ZD1211 device*
# *---> Checking if device exists has been removed bacause it gave too many errors... *
# *---> Please send comments/suggestions to
d4rkritu4l@gmail.com *
# *---> Tested on SUSE 9.3 professional with a zd1211-based Canyon usb stick. *
# *---> For SUSE, you need to configure the wlan device in YAST, but change startup type *
# *---> to MANUAL, and start it with this script instead... *
# *---> - CoDeGuRuS 2005 - *
# *******************************************************************************************
# change this gateway as needed:
GATEWAY=192.168.2.1
# dummy ip ---> needs to be one not used in your network, will be used to temporarily
# give the wlan device an ip adress to prevent routing errors
DUMMY_IP=192.168.2.99
function start() {
#
# Start Wireless Networking
#
echo "+++ Starting WLAN interface..."
/sbin/modprobe -a zd1211
sleep 2
/sbin/ifconfig wlan0 up
sleep 2
/sbin/ifconfig wlan0 $DUMMY_IP
sleep 2
/sbin/ifup wlan0
/sbin/route add default gw $GATEWAY
}
function stop() {
#
# Shut down the WLAN
#
echo "+++ Stopping WLAN..."
/sbin/route del default gw $GATEWAY
/sbin/ifdown wlan0
}
# are-we-running variable
WLANIF=`ifconfig | grep wlan0 | cut -c 1-5`
# See how we were called.
case "$1" in
start)
# Start WLAN if not already running
if [ "$WLANIF" != "wlan0" ]; then
start
else
echo "WLAN is already running!"
fi
;;
stop)
# Stop WLAN
if [ "$WLANIF" = "wlan0" ]; then
stop
else
echo "WLAN is not running!"
fi
;;
restart|reload)
$0 stop
$0 start
;;
status)
if [ "$WLANIF" = "wlan0" ]; then
echo -n "WLAN is running...."
else
echo -n "WLAN not running."
fi
echo
;;
*)
echo "Usage: cgs-zd1211_control {start|stop|restart|status}"
exit 1
esac
exit 0