#!/bin/bash #chkconfig: 2345 80 05 #description: Huawei e200 init script # to add as service run: #chkconfig --add oracle # Source function library. . /etc/rc.d/init.d/functions file=/tmp/orange.log start() { echo -n $"Starting huawei-e220: " /sbin/rmmod usbserial 2>/dev/null /usr/local/bin/huaweiAktBbo-i386.out 1>/dev/null /sbin/modprobe usbserial vendor=0x12d1 product=0x1003 wvdial orange 2>$file & echo "nameserver 213.151.208.161" > /etc/resolv.conf echo "nameserver 213.151.200.30" >> /etc/resolv.conf TRIES=10 while [ -z "`cat $file | grep DNS`" ] do if [ $TRIES -eq 0 ]; then failure exit 1 fi sleep 1 let TRIES=TRIES-1 done success echo "" } stop() { echo -n $"Stopping huawei-e220: " if [ -n "`/sbin/pidof wvdial`" ] ; then killproc wvdial rm $file success else failure fi echo "" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status wvdial RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|status}" RETVAL=1 esac exit $RETVAL