rsnapshot
rsnapshot copied to clipboard
Feature request: support backup_exec scripts with context
I've been using backup_exec
entries for a while on systems here to drive an rsync
script that understands how to copy only files that been modified in the last 3 years.
Unfortunately for my use case, backup_exec
scripts are run in $HOME
rather than in the snapshot_root
, which means I have to pass a load of extra parameters to my script that replicate information already provided to rsnapshot
.
I would like to offer a small patch that exports all the simple configuration variables as environment variables ready for such a script to reference. (I considered patching the change directory requirement so that it was specific to the preexec
and postexec
commands but decided against that because that might break existing scripts.)
Amongst others, the following environment variables are declared for scripts
RSNAPSHOT_cmd_rsync='/usr/bin/rsync'
RSNAPSHOT_cmd_ssh='/usr/bin/ssh'
RSNAPSHOT_rsync_long_args='--delete --delete-excluded --numeric-ids --fake-super --fuzzy --fuzzy --delete-after'
RSNAPSHOT_rsync_short_args='-avzSi'
RSNAPSHOT_snapshot_root='/backup/Rsync/Romania'
@roaima
The patch looks reasonable. Would you mind sending it as pull request or with git format-patch
, so that the authorship information is retained?
For integration I would rather see this being configurable to prevent inadvertently leaking information: either on/off switch for the feature or ignore/unignore patterns for the options. I'll have a look into that.
Sure. I'll see if I can work out how to do that.