Hi, it would be really useful to have some kind of --pre-cmd/--post-cmd and esp. more advanced like --post-cmd-fail, --post-cmd-success. rsync should then execute the passed scripts and (add a command for it as well?) it should also pass the list of transfered (all), failed or successfully transfered files/dirs. A control option for it could e.g. look like --cmd-pass=[0|1|2|3] where: 0 = disabled, nothing passed at all 1 = only successfully transfered objects 2 = only failed 3 = any That would make rsync almost perfect and one could easily take care of different situations without having to parse the complete output of rsync. It shouldn't be that difficult actually, esp. basic pre/post cmds. I'd perhaps even try to write a patch that adds the mentioned features (in case I get to it).
Personally, I wouldn't have any use for the processing of the output part but a pre and post command to create and destroy lvm2 snapshots would be useful. Especially in keeping rsync from attempting to backup an empty mountpoint if the snapshot fails. Yes, this can be handled in a script but it would be easier if rsync handled it internally especially if using a restricted ssh key for access to the system being backed up.
regarding restricted ssh - wouldn`t that be a security nightmare if rsync could exec any additional command ?
(In reply to comment #2) > regarding restricted ssh - wouldn`t that be a security nightmare if rsync could > exec any additional command ? At least my idea is meant to be client side only.
These are called shell scripts. :-) If you're not using a daemon, you're expected to code up your copy commands yourself. The daemon gets some special support since there is not a way to tell the server side to run some extra commands. Note that you can choose to use ssh to run a daemon rsync that has certain pre/post commands included in the config if that is something that you would find useful.