--- a/rsyncd 2011-12-09 22:57:38.151602418 +0100 +++ b/rsyncd 2011-12-09 22:56:14.671078987 +0100 @@ -5,6 +5,8 @@ [ -f /etc/conf.d/rsyncd ] && . /etc/conf.d/rsyncd +PIDFILE=${PIDFILE:-/var/run/rsyncd.pid} + function call_rsyncd() { /usr/bin/rsync --daemon $RSYNCD_ARGS } @@ -16,7 +18,8 @@ if [ $? -gt 0 ]; then stat_fail else - #pgrep -of "/usr/bin/rsync --daemon" > /var/run/rsyncd.pid # Removed FS#20942 + pid=$(pgrep -of "/usr/bin/rsync --daemon") + [[ -n $pid && ! -e $PIDFILE ]] && echo $pid > $PIDFILE add_daemon rsyncd stat_done fi @@ -24,10 +27,11 @@ stop) stat_busy "Stopping rsyncd" - [ -f /var/run/rsyncd.pid ] && kill `cat /var/run/rsyncd.pid` + [ -f $PIDFILE ] && kill `cat $PIDFILE` if [ $? -gt 0 ]; then stat_fail else + [[ -e $PIDFILE ]] && rm $PIDFILE rm_daemon rsyncd stat_done fi