rsync/ssh/rsnapshot backup -- remote script execution
rsnapshot configuration files are tab delimited. Make sure you include tabs
between the backup_scrip, the ssh command, and the backup storage. If that does not work try running rsnapshot configtest
to identify the problem.
Answer updated
It is more convenient to transform your backup line to the following format:
backup_script /dir/yourscript.sh backupdirectory/
Place the middle section in a shell script, make it executable and test it.
In addition to this, the ssh [email protected]
should connect to the remote host without a password non-interactively.
The rsnapshot.conf
example actually uses backup_exec
, not backup_script
. However, backup_script
can still be used to run arbitrary commands over ssh and sync any files generated in a temp directory. Any commands used must be referenced by absolute path. This worked for me, for one of my mysql databases:
backup_script [tab] /usr/bin/ssh [email protected] "/usr/bin/mysqldump --single-transaction -u username dbname" > dbname.sql [tab] example.com/mysql/