wok-next annotate get-softmodem-driver/stuff/martian.init @ rev 3498
get-softmodem-driver: Add automatic country detection during martian install
author | Dominique Corbex <domcox@users.sourceforge.net> |
---|---|
date | Thu Jun 18 21:10:59 2009 +0200 (2009-06-18) |
parents | 778f75d8af14 |
children | e26a09e68fcb |
rev | line source |
---|---|
domcox@3464 | 1 #!/bin/sh |
domcox@3464 | 2 # /etc/init.d/martian: Start, stop and restart martian deamon on SliTaz, at boot |
domcox@3464 | 3 # time or with the command line. |
domcox@3464 | 4 # |
domcox@3464 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
domcox@3464 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
domcox@3464 | 7 # |
domcox@3464 | 8 . /etc/init.d/rc.functions |
domcox@3464 | 9 . /etc/daemons.conf |
domcox@3464 | 10 |
domcox@3479 | 11 NAME="Martian modem" |
domcox@3464 | 12 DESC="Agere Systems PCI Modem deamon" |
domcox@3464 | 13 DAEMON=/usr/sbin/martian_modem |
domcox@3498 | 14 OPTIONS="--daemon $MARTIAN_OPTIONS" |
domcox@3464 | 15 PIDFILE=/var/run/martian.pid |
domcox@3478 | 16 MODULE="martian_dev" |
domcox@3464 | 17 |
domcox@3478 | 18 if [ `/sbin/lsmod | grep -c ${MODULE}` -lt "1" ]; then |
domcox@3464 | 19 echo "kernel module is not loaded!" |
domcox@3464 | 20 exit 1 |
domcox@3464 | 21 fi |
domcox@3464 | 22 |
domcox@3464 | 23 case "$1" in |
domcox@3464 | 24 start) |
domcox@3464 | 25 if [ -f $PIDFILE ] ; then |
domcox@3464 | 26 echo "$NAME already running." |
domcox@3464 | 27 exit 1 |
domcox@3464 | 28 fi |
domcox@3464 | 29 echo -n "Starting $DESC: $NAME... " |
domcox@3479 | 30 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE |
domcox@3464 | 31 status |
domcox@3464 | 32 ;; |
domcox@3464 | 33 stop) |
domcox@3464 | 34 if [ ! -f $PIDFILE ] ; then |
domcox@3464 | 35 echo "$NAME is not running." |
domcox@3464 | 36 exit 1 |
domcox@3464 | 37 fi |
domcox@3464 | 38 echo -n "Stopping $DESC: $NAME... " |
domcox@3498 | 39 killall martian_modem |
domcox@3498 | 40 rm $PIDFILE |
domcox@3464 | 41 status |
domcox@3464 | 42 ;; |
domcox@3464 | 43 restart) |
domcox@3464 | 44 if [ ! -f $PIDFILE ] ; then |
domcox@3464 | 45 echo "$NAME is not running." |
domcox@3464 | 46 exit 1 |
domcox@3464 | 47 fi |
domcox@3464 | 48 echo -n "Restarting $DESC: $NAME... " |
domcox@3498 | 49 killall martian_modem |
domcox@3464 | 50 sleep 2 |
domcox@3479 | 51 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE |
domcox@3464 | 52 status |
domcox@3464 | 53 ;; |
domcox@3464 | 54 *) |
domcox@3464 | 55 echo "" |
domcox@3464 | 56 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
domcox@3464 | 57 echo "" |
domcox@3464 | 58 exit 1 |
domcox@3464 | 59 ;; |
domcox@3464 | 60 esac |
domcox@3464 | 61 |
domcox@3464 | 62 exit 0 |