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