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