wok annotate get-softmodem-driver/stuff/martian.init @ rev 3479
get-softmodem-driver: bug fixes
author | Dominique Corbex <domcox@users.sourceforge.net> |
---|---|
date | Wed Jun 17 10:05:35 2009 +0200 (2009-06-17) |
parents | e5ab27ad8b9e |
children | 07633a539a9d |
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@3464 | 14 OPTIONS="--daemon $MARTIAN_OPTIONS /dev/ttySM0" |
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@3464 | 39 kill `cat $PIDFILE` |
domcox@3464 | 40 status |
domcox@3464 | 41 ;; |
domcox@3464 | 42 restart) |
domcox@3464 | 43 if [ ! -f $PIDFILE ] ; then |
domcox@3464 | 44 echo "$NAME is not running." |
domcox@3464 | 45 exit 1 |
domcox@3464 | 46 fi |
domcox@3464 | 47 echo -n "Restarting $DESC: $NAME... " |
domcox@3464 | 48 kill `cat $PIDFILE` |
domcox@3464 | 49 sleep 2 |
domcox@3479 | 50 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE |
domcox@3464 | 51 status |
domcox@3464 | 52 ;; |
domcox@3464 | 53 *) |
domcox@3464 | 54 echo "" |
domcox@3464 | 55 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
domcox@3464 | 56 echo "" |
domcox@3464 | 57 exit 1 |
domcox@3464 | 58 ;; |
domcox@3464 | 59 esac |
domcox@3464 | 60 |
domcox@3464 | 61 exit 0 |