wok annotate get-softmodem-driver/stuff/slmodem.init @ rev 17828
Up: slitaz-tools*(5.8.15)
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Sun Mar 22 22:36:11 2015 +0100 (2015-03-22) |
parents | |
children | ff5fd8788cd9 |
rev | line source |
---|---|
pascal@13591 | 1 #!/bin/sh |
pascal@13591 | 2 # /etc/init.d/slmodem: Start, stop and restart slmodemd 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="Smartlink modem" |
pascal@13591 | 12 DESC="Smart Link Modem deamon" |
pascal@13591 | 13 DAEMON=/usr/sbin/slmodemd |
pascal@13591 | 14 OPTIONS=$SLMODEM_OPTIONS |
pascal@13591 | 15 PIDFILE=/var/run/slmodemd.pid |
pascal@13591 | 16 |
pascal@13591 | 17 case "$1" in |
pascal@13591 | 18 start) |
pascal@13591 | 19 if active_pidfile $PIDFILE slmodemd ; then |
pascal@13591 | 20 echo "$NAME already running." |
pascal@13591 | 21 exit 1 |
pascal@13591 | 22 fi |
pascal@13591 | 23 echo -n "Starting $DESC: $NAME... " |
pascal@13591 | 24 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE |
pascal@13591 | 25 status |
pascal@13591 | 26 ;; |
pascal@13591 | 27 stop) |
pascal@13591 | 28 if ! active_pidfile $PIDFILE slmodemd ; then |
pascal@13591 | 29 echo "$NAME is not running." |
pascal@13591 | 30 exit 1 |
pascal@13591 | 31 fi |
pascal@13591 | 32 echo -n "Stopping $DESC: $NAME... " |
pascal@13591 | 33 kill `cat $PIDFILE` |
pascal@13591 | 34 status |
pascal@13591 | 35 ;; |
pascal@13591 | 36 restart) |
pascal@13591 | 37 if ! active_pidfile $PIDFILE slmodemd ; then |
pascal@13591 | 38 echo "$NAME is not running." |
pascal@13591 | 39 exit 1 |
pascal@13591 | 40 fi |
pascal@13591 | 41 echo -n "Restarting $DESC: $NAME... " |
pascal@13591 | 42 kill `cat $PIDFILE` |
pascal@13591 | 43 sleep 2 |
pascal@13591 | 44 $DAEMON $OPTIONS && echo `/bin/pidof $DAEMON` > $PIDFILE |
pascal@13591 | 45 status |
pascal@13591 | 46 ;; |
pascal@13591 | 47 *) |
pascal@13591 | 48 echo "" |
pascal@13591 | 49 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@13591 | 50 echo "" |
pascal@13591 | 51 exit 1 |
pascal@13591 | 52 ;; |
pascal@13591 | 53 esac |
pascal@13591 | 54 |
pascal@13591 | 55 exit 0 |