Bug 10405 - Feature request: Add support for pre/post cmds for the rsync client
Summary: Feature request: Add support for pre/post cmds for the rsync client
Status: RESOLVED WONTFIX
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-29 21:50 UTC by Christian Ruppert
Modified: 2020-07-27 23:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Ruppert 2014-01-29 21:50:44 UTC
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).
Comment 1 Kevin Korb 2014-01-29 21:57:03 UTC
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.
Comment 2 roland 2014-08-06 21:45:38 UTC
regarding restricted ssh - wouldn`t that be a security nightmare if rsync could exec any additional command ?
Comment 3 Christian Ruppert 2014-08-07 19:17:22 UTC
(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.
Comment 4 Wayne Davison 2020-07-27 23:55:52 UTC
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.