rsync server bootscript - stop and status considerations

Alexander Dahl post at lespocky.de
Wed Dec 29 02:27:07 MST 2010


Hello,

sorry for the late answer, I just try to catch up with my mailing lists …

Am 15.12.2010 15:20, schrieb rsync at catcons.co.uk:
> 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.

I did write an init script for eisfair-1¹ roughly one year ago. I took
into account not killing any rsync processes running not as daemon.

> 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.

How did you verify this? I assume like this:

 * run the daemon
 * start at least two client connections from somewhere
 * see the process list
 * kill the deamon
 * see the process list again

> A bootscript restart or stop option should do the same; it should send
> SIGTERM to all the rsync server processes. 

Why should it? Don't the worker processes terminate when their
transmissions are complete? I would assume it's enough to restart the
"main" daemon.

> 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.

Interesting thought. How would you implement this?

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

I don't find it that obvious, as explained above. I would just restart
the daemon in case of a changed config for example to make new
connections possible. I wouldn't touch running rsync operations, because
these must not be restartet, must they?

If you're interested in my script, you could extract it from
http://www.pack-eis.de/dl.php?l=9592/rsync.tar.bz2 – this archive
contains a / folder structure, you should find the script in /etc/init.d 8-)

Greets
Alex

¹ http://www.eisfair.org/

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/rsync/attachments/20101229/8a3826a7/attachment.pgp>


More information about the rsync mailing list