rsync: improved rc script

This commit is contained in:
Juergen Daubert 2015-06-26 17:12:45 +02:00
parent 53c69caf35
commit 992a365c3e
3 changed files with 19 additions and 6 deletions

View File

@ -1,4 +1,4 @@
43bd6676f0b404326eee2d63be3cdcfe rsync-3.1.1.tar.gz
bd6cc8e2c83d5e845af20a30e105fb5f rsync.driver
a71995f22768c931c5649a1336d25ffb rsyncd
d20f1ca0fb415a6788808c75170d951a rsyncd
b4e95fa8c8f3ae13cfdf616abd6a3960 rsyncd.conf

View File

@ -5,7 +5,7 @@
name=rsync
version=3.1.1
release=1
release=2
source=(http://rsync.samba.org/ftp/$name/src/$name-$version.tar.gz \
rsyncd.conf rsyncd rsync.driver)

View File

@ -3,20 +3,33 @@
# /etc/rc.d/rsyncd: start/stop rsyncd daemon
#
SSD=/sbin/start-stop-daemon
PROG=/usr/bin/rsync
PID=/var/run/rsyncd.pid
OPTS="--daemon"
case $1 in
start)
/usr/bin/rsync --daemon
$SSD --start --pidfile $PID --exec $PROG -- $OPTS
;;
stop)
kill `cat /var/run/rsyncd.pid`
$SSD --stop --retry 10 --pidfile $PID
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
$SSD --status --pidfile $PID
case $? in
0) echo "$PROG is running with pid $(cat $PID)" ;;
1) echo "$PROG is not running but the pid file $PID exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart]"
echo "usage: $0 [start|stop|restart|status]"
;;
esac