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