45 lines
926 B
Bash
45 lines
926 B
Bash
#! /bin/sh
|
|
#
|
|
# chkconfig: 2345 50 50
|
|
# description: rsync service
|
|
|
|
# source function library
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
PROG='/usr/bin/rsync'
|
|
BASE=${0##*/}
|
|
|
|
# Adapt the --config parameter to point to your rsync daemon configuration
|
|
# The config file must contain following line:
|
|
# pid file = /var/run/<filename>.pid
|
|
# Where <filename> is the filename of the init script (= this file)
|
|
OPTIONS="--daemon --config=/etc/rsyncd.conf"
|
|
|
|
case "$1" in
|
|
start)
|
|
echo -n $"Starting $BASE: "
|
|
daemon --check $BASE $PROG $OPTIONS
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASE
|
|
echo
|
|
;;
|
|
stop)
|
|
echo -n $"Shutting down $BASE: "
|
|
killproc $BASE
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASE
|
|
echo
|
|
;;
|
|
restart|force-reload)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|