wok-next annotate get-softmodem-driver/stuff/martian.init @ rev 3464
get-softmodem-driver: Add support for Agere Systems Modem
author | Dominique Corbex <domcox@users.sourceforge.net> |
---|---|
date | Tue Jun 16 13:10:15 2009 +0200 (2009-06-16) |
parents | |
children | e5ab27ad8b9e |
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@3464 | 16 |
domcox@3464 | 17 if [ `/sbin/lsmod | grep -c martian_dev}` -lt "1" ]; then |
domcox@3464 | 18 echo "kernel module is not loaded!" |
domcox@3464 | 19 exit 1 |
domcox@3464 | 20 fi |
domcox@3464 | 21 |
domcox@3464 | 22 case "$1" in |
domcox@3464 | 23 start) |
domcox@3464 | 24 if [ -f $PIDFILE ] ; then |
domcox@3464 | 25 echo "$NAME already running." |
domcox@3464 | 26 exit 1 |
domcox@3464 | 27 fi |
domcox@3464 | 28 echo -n "Starting $DESC: $NAME... " |
domcox@3464 | 29 $DAEMON $OPTIONS |
domcox@3464 | 30 status |
domcox@3464 | 31 echo `/sbin/pidof $DAEMON` > $PIDFILE |
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@3464 | 50 $DAEMON $OPTIONS |
domcox@3464 | 51 status |
domcox@3464 | 52 echo `/sbin/pidof $DAEMON` > $PIDFILE |
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 |