wok annotate ofono/stuff/etc/init.d/ofono @ rev 19159
/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu May 26 20:16:45 2016 +0300 (2016-05-26) |
parents | 8ebec64e4191 |
children |
rev | line source |
---|---|
domcox@15396 | 1 #!/bin/sh |
domcox@15396 | 2 # /etc/init.d/ofono : Start, stop and restart the Mobile Telephony manager |
domcox@15396 | 3 # on SliTaz, at boot time or with the command line. |
domcox@15396 | 4 # |
domcox@15396 | 5 # To start the Mobile Telephony manager at boot time, just put ofono in the |
domcox@15396 | 6 # $RUN_DAEMONS variable of /etc/rcS.conf and configure options with |
domcox@15396 | 7 # /etc/daemons.conf |
domcox@15396 | 8 # |
domcox@15396 | 9 . /etc/init.d/rc.functions |
domcox@15396 | 10 . /etc/daemons.conf |
domcox@15396 | 11 |
domcox@15396 | 12 NAME=Ofono |
al@19159 | 13 DESC="$(_ 'Mobile telephony Manager')" |
domcox@15396 | 14 DAEMON=/usr/sbin/ofonod |
domcox@15396 | 15 OPTIONS=$OFONO_OPTIONS |
pascal@15577 | 16 PIDFILE=/var/run/ofono.pid |
domcox@15396 | 17 |
domcox@15396 | 18 case "$1" in |
domcox@15396 | 19 start) |
pascal@15577 | 20 if active_pidfile $PIDFILE ofonod ; then |
al@19159 | 21 _ '%s is already running.' $NAME |
domcox@15396 | 22 exit 1 |
domcox@15396 | 23 fi |
al@19159 | 24 action 'Starting %s: %s...' "$DESC" $NAME |
domcox@15396 | 25 $DAEMON $OPTIONS |
domcox@15396 | 26 status |
pascal@15577 | 27 pidof ofonod > $PIDFILE |
domcox@15396 | 28 ;; |
domcox@15396 | 29 stop) |
pascal@15577 | 30 if ! active_pidfile $PIDFILE ofonod ; then |
al@19159 | 31 _ '%s is not running.' $NAME |
domcox@15396 | 32 exit 1 |
domcox@15396 | 33 fi |
al@19159 | 34 action 'Stopping %s: %s...' "$DESC" $NAME |
pascal@15577 | 35 rm -rf $PIDFILE |
pascal@15577 | 36 kill $(pidof ofonod) |
pascal@15577 | 37 status |
domcox@15396 | 38 ;; |
domcox@15396 | 39 restart) |
pascal@15577 | 40 if ! active_pidfile $PIDFILE ofonod ; then |
al@19159 | 41 _ '%s is not running.' $NAME |
domcox@15396 | 42 exit 1 |
domcox@15396 | 43 fi |
al@19159 | 44 action 'Restarting %s: %s...' "$DESC" $NAME |
pascal@15577 | 45 rm -rf $PIDFILE |
domcox@15396 | 46 kill $(pidof ofonod) && |
domcox@15396 | 47 sleep 2 && |
domcox@15396 | 48 $DAEMON $OPTIONS |
domcox@15396 | 49 status |
domcox@15396 | 50 ;; |
domcox@15396 | 51 *) |
al@19159 | 52 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 53 newline |
domcox@15396 | 54 ;; |
domcox@15396 | 55 esac |
domcox@15396 | 56 |
domcox@15396 | 57 exit 0 |