wok annotate boxbackup-server/stuff/bbstored @ 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 | e99b372b0465 |
children | ff5fd8788cd9 |
rev | line source |
---|---|
domcox@1357 | 1 #!/bin/sh |
domcox@1357 | 2 # /etc/init.d/bbstored: Start, stop and restart bbstored deamon on SliTaz, at boot |
domcox@1357 | 3 # time or with the command line. |
domcox@1357 | 4 # |
domcox@1357 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
domcox@1357 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
domcox@1357 | 7 # |
domcox@1357 | 8 . /etc/init.d/rc.functions |
domcox@1357 | 9 . /etc/daemons.conf |
domcox@1357 | 10 |
domcox@1357 | 11 NAME=BBstored |
al@19159 | 12 DESC="$(_ 'BoxBackup server deamon')" |
domcox@1357 | 13 DAEMON=/usr/bin/bbstored |
domcox@1357 | 14 OPTIONS=$BBSTORED_OPTIONS |
domcox@1357 | 15 PIDFILE=/var/run/bbstored.pid |
domcox@1357 | 16 |
domcox@1357 | 17 case "$1" in |
domcox@1357 | 18 start) |
pascal@11691 | 19 if active_pidfile $PIDFILE bbstored ; then |
al@19159 | 20 _ '%s is already running.' $NAME |
domcox@1357 | 21 exit 1 |
domcox@1357 | 22 fi |
al@19159 | 23 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 24 $DAEMON $OPTIONS >/dev/null |
domcox@1357 | 25 status |
domcox@1357 | 26 ;; |
domcox@1357 | 27 stop) |
pascal@11691 | 28 if ! active_pidfile $PIDFILE bbstored ; then |
al@19159 | 29 _ '%s is not running.' $NAME |
domcox@1357 | 30 exit 1 |
domcox@1357 | 31 fi |
al@19159 | 32 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 33 kill $(cat $PIDFILE) |
al@19159 | 34 rm -f $PIDFILE |
domcox@1357 | 35 status |
domcox@1357 | 36 ;; |
domcox@1357 | 37 restart) |
pascal@11691 | 38 if ! active_pidfile $PIDFILE bbstored ; then |
al@19159 | 39 _ '%s is not running.' $NAME |
domcox@1357 | 40 exit 1 |
domcox@1357 | 41 fi |
al@19159 | 42 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 43 kill $(cat $PIDFILE) |
al@19159 | 44 rm -f $PIDFILE |
domcox@1357 | 45 sleep 2 |
al@19159 | 46 $DAEMON $OPTIONS >/dev/null |
domcox@1357 | 47 status |
domcox@1357 | 48 ;; |
domcox@1357 | 49 *) |
al@19159 | 50 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 51 newline |
domcox@1357 | 52 exit 1 |
domcox@1357 | 53 ;; |
domcox@1357 | 54 esac |
domcox@1357 | 55 |
domcox@1357 | 56 exit 0 |