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 lock. Thanks
On Sat, Nov 23, 2013 at 11:36 AM, Thomas Jordan <tomjordan766 at gmail.com>wrote:> 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 > inetdYes, that would work fine for an inetd approach. For a daemon approach, you could use a type of pid-lock mechanism using the "pre-xfer exec" and "post-xfer exec" scripts and the $RSYNC_PID env var. The only thing that is weird about that is that the RSYNC_PID value is the pid of the pre-xfer exec proc, not the pid of the transfer proc. If you want to build in automatic lock busting, you'd need to store both the $RSYNC_PID and the pre-xfer func's parent-pid inside the lock file so that it can check for a running process using the parent pid (and the post-xfer script can remove the lock based on the $RSYNC_PID match). ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20131123/98e27d94/attachment.html>
Seemingly Similar Threads
- (when) does rsync daemon sync ?
- Regarding an "earlier" variant of `pre-xfer exec` [feature request and proposed patch]
- How to process files on the server side after a sync?
- mail rsync logs
- [Bug 8188] New: Mechanism for taking an rsync server down for maintenance