Linux – rsync/ssh/rsnapshot backup — remote script execution

backuplinuxrsnapshotrsyncssh

I have the following settings in my configuration file: (/etc/rsnapshot.conf)

Script/Tool: http://www.rsnapshot.org/

backup_script   ssh     root@host.domain.com "sh /home/user/backup_mysql.sh"     ./mysql

the example shows the following:

backup_script  ssh root@example.com "mysqldump -A > /var/db/dump/mysql.sql"    unused2

The error I get:

ERROR: backup_script /usr/bin/ssh returned 255  

What am I doing wrong?

Best Answer

One possible way would be converting ssh root@host.domain.com "sh /home/user/backup_mysql.sh" into a script (do_ssh.sh,here) and invoke that script.

Something like,

backup_script /path/to/do_ssh.sh ./mysql

I'd also recommend you to try putting quotes around your entire command.

backup_script "ssh root@host.domain.com "sh /home/user/backup_mysql.sh"" ./mysql