wok-6.x annotate get-softmodem-driver/stuff/slmodem.init @ rev 23492
python-bcrypt: added build dependencies
author | Hans-G?nter Theisgen |
---|---|
date | Mon Apr 06 06:26:59 2020 +0100 (2020-04-06) |
parents | 4aed2b24febc |
children |
rev | line source |
---|---|
pascal@13591 | 1 #!/bin/sh |
al@19161 | 2 # /etc/init.d/slmodem: Start, stop and restart slmodemd daemon 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" |
al@19161 | 12 DESC="$(_ 'Smart Link Modem daemon')" |
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 |
al@19161 | 20 _ '%s is already running.' "$NAME" |
pascal@13591 | 21 exit 1 |
pascal@13591 | 22 fi |
al@19161 | 23 action 'Starting %s: %s...' "$DESC" "$NAME" |
al@19161 | 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 |
al@19161 | 29 _ '%s is not running.' "$NAME" |
pascal@13591 | 30 exit 1 |
pascal@13591 | 31 fi |
al@19161 | 32 action 'Stopping %s: %s...' "$DESC" "$NAME" |
al@19161 | 33 kill $(cat $PIDFILE) |
pascal@13591 | 34 status |
pascal@13591 | 35 ;; |
pascal@13591 | 36 restart) |
pascal@13591 | 37 if ! active_pidfile $PIDFILE slmodemd ; then |
al@19161 | 38 _ '%s is not running.' "$NAME" |
pascal@13591 | 39 exit 1 |
pascal@13591 | 40 fi |
al@19161 | 41 action 'Restarting %s: %s...' "$DESC" "$NAME" |
al@19161 | 42 kill $(cat $PIDFILE) |
pascal@13591 | 43 sleep 2 |
al@19161 | 44 $DAEMON $OPTIONS && echo $(/bin/pidof $DAEMON) > $PIDFILE |
pascal@13591 | 45 status |
pascal@13591 | 46 ;; |
pascal@13591 | 47 *) |
al@19161 | 48 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19161 | 49 newline |
pascal@13591 | 50 exit 1 |
pascal@13591 | 51 ;; |
pascal@13591 | 52 esac |
pascal@13591 | 53 |
pascal@13591 | 54 exit 0 |