patch to rsync to add options for pre- and post-transfer
jw at pegasys.ws
Sat Jun 7 08:28:14 EST 2003
On Fri, Jun 06, 2003 at 02:21:20PM -0600, David S. Ahern wrote:
> In case others find this of value, I wrote a patch to rsync 2.5.6 to
> give rsync in --daemon mode the ability to run a pre-transfer and
> post-transfer command. These options handle our need to prepare a server
> to receive files and to do some processing after receiving files.
> The options for /etc/rsyncd.conf are
> pretransfer script = /some/command/to/run
> posttransfer script = /some/other/command
> The commands are exec'd (not run through system() or popen()) and the
> inputs are the list of files (and directories) that are being synched
> (from struct file_list *flist).
> If the pretransfer script fails the synch is stopped.
Firstly, if doing this you need to cope with arguments for
the script. And if passing the file list do so on stdin;
What, pray tell, are you going to do if the file list is
286,000 entries? Where is stdout and stderr of the
pre and post "scripts" going. Don't assume that the
commands will be scripts unless you plan on passing them as
arguments to /bin/sh.
Finally, I don't like it. Rsync is not a swiss army knife.
This isn't a feature, it is a function. If you need pre and
post commands run a script on the client or create a wrapper
daemon that does the pre action, runs a one-shot rsync
daemon and then does the post action.
J.W. Schultz Pegasystems Technologies
email address: jw at pegasys.ws
Remember Cernan and Schmitt
More information about the rsync