wok-next annotate get-softmodem-driver/stuff/martian.init @ rev 3478
get-softmodem-driver: packages are now saved in tazwok packages_repository
author | Dominique Corbex <domcox@users.sourceforge.net> |
---|---|
date | Wed Jun 17 09:49:44 2009 +0200 (2009-06-17) |
parents | 1f6bff831481 |
children | 778f75d8af14 |
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@3464 | 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@3464 | 30 $DAEMON $OPTIONS |
domcox@3464 | 31 status |
domcox@3464 | 32 echo `/sbin/pidof $DAEMON` > $PIDFILE |
domcox@3464 | 33 ;; |
domcox@3464 | 34 stop) |
domcox@3464 | 35 if [ ! -f $PIDFILE ] ; then |
domcox@3464 | 36 echo "$NAME is not running." |
domcox@3464 | 37 exit 1 |
domcox@3464 | 38 fi |
domcox@3464 | 39 echo -n "Stopping $DESC: $NAME... " |
domcox@3464 | 40 kill `cat $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@3464 | 49 kill `cat $PIDFILE` |
domcox@3464 | 50 sleep 2 |
domcox@3464 | 51 $DAEMON $OPTIONS |
domcox@3464 | 52 status |
domcox@3464 | 53 echo `/sbin/pidof $DAEMON` > $PIDFILE |
domcox@3464 | 54 ;; |
domcox@3464 | 55 *) |
domcox@3464 | 56 echo "" |
domcox@3464 | 57 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
domcox@3464 | 58 echo "" |
domcox@3464 | 59 exit 1 |
domcox@3464 | 60 ;; |
domcox@3464 | 61 esac |
domcox@3464 | 62 |
domcox@3464 | 63 exit 0 |