rsync with (f)locks

Thomas Jordan tomjordan766 at
Sat Nov 23 12:36:56 MST 2013

 From the rsync manual documentation I see that by using the option 
rsync-path, it is possible to specify what program is to be run on the 
remote machine to start up rsync. In particular, the program could be a 
wrapper script which calls the actual rsync command in the middle, but 
which does some actions before and/or after the rsync invocation. One 
possible interesting use would be to acquire/release a lock (e.g., a 
flock), so that the operations of rsync at the remote end could be 
co-ordinated with another process which is contending for write access 
to the same files.

My question is: can you also put a wrapper around rsync when using the 
inetd (or xinetd) daemon approach to running rsync, by adding a line for 
inetd something like the following to /etc/inetd.conf (as per the 
rsyncd.conf man page):

rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon

but replacing /usr/bin/rsync with the path to your rsync-lookalike 
wrapper, which in this case would be a C/C++ -code program which seizes 
a lock, forks off rsync, waits for rsync to complete, then releases the 


More information about the rsync mailing list