wok annotate rsync/stuff/etc/init.d/rsyncd @ rev 22023
Remove cat process
| author | Pascal Bellard <pascal.bellard@slitaz.org> |
|---|---|
| date | Sun Oct 20 12:39:13 2019 +0200 (2019-10-20) |
| parents | 7f188676b59c |
| children |
| rev | line source |
|---|---|
| pankso@8 | 1 #!/bin/sh |
| al@19161 | 2 # /etc/init.d/rsyncd: Start, stop and restart Rsync daemon 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 |