rsync server bootscript - stop and status considerations

rsync at catcons.co.uk rsync at catcons.co.uk
Wed Dec 15 07:20:31 MST 2010


Hello :-)

I want to create a boot/shutdown script including the usual restart, start,
status and stop options (on Slackware64 13.1).  Netsearching for prior art,
I did not find any comprehensive examples.  The normal technique seems to be
to kill the process recorded in the PID file (let's call it the daemon) but
this does not terminate all the rsync server processes.

Experimenting and reading the documentation it seems that rsync in daemon
mode spawns a worker process for each connection and they in turn spawn
further workers.  When the daemon is killed the connection leader(s)
re-parent themselves to the init process and continue to run.

This works OK as part of a Linux OS shutdown because all processes are
eventually sent SIGTERM so the remaining rsync server processes have
opportunity to stop in an orderly manner before Linux sends SIGKILL to any
remaining processes.

A bootscript restart or stop option should do the same; it should send
SIGTERM to all the rsync server processes.  Similarly a bootscript status
option should report not only the status of the process recorded in the PID
file but also of any worker processes.

This seems so obvious I am surprised not to have found comprehensive prior
art so wonder if I have overlooked something basic ... ?

Best      

Charles



More information about the rsync mailing list