Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Which configuration file? –  Stephan Feb 14 '13 at 22:09
    
/etc/rsnapshot.conf –  Tiffany Walker Feb 14 '13 at 22:11
    
There's some key information missing here -- at first glance: (1) We have no idea what configuration file is (what program are you configuring?) ; (2) We have no idea what backup_script is doing. ; (3) What happens when you try running the ssh portion of the process manually? -- can you update your question to tell us more about what you're trying to do? (See Also: How can I ask better questions on Server Fault –  voretaq7 Feb 14 '13 at 22:11
    
is 'backup_script' executable? –  Stephan Feb 14 '13 at 22:17
    
Dirvish is excellent for this: it allows pre- and post- execution scripts on the server and the client. –  Andrew Feb 15 '13 at 2:02

4 Answers 4

up vote 0 down vote accepted

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

share|improve this answer
    
The first trick worked. –  Tiffany Walker Feb 19 '13 at 19:19

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 root@host.domain.com should connect to the remote host without a password non-interactively.

share|improve this answer
    
yea, nothing wrong with tabs or config file –  Tiffany Walker Feb 15 '13 at 5:39

The problem is something to do with ssh. From the ssh man page

ssh exits with the exit status of the remote command or with 255 if an error occurred

You should use ssh -v[vv] to get a verbose output from ssh and see what it has to say.

share|improve this answer
    
So the issue is probably executing the command over SSH? –  Tiffany Walker Feb 19 '13 at 18:51
    
@TiffanyWalker: That's what it looks like just try ssh root@... and see what error you get or ssh -v[vv] ... –  Iain Feb 20 '13 at 7:38

Have you set up key authentication with the remote host, or is the ssh command expecting you to type in a password interactively?

If you haven't set up passwordless authentication, then the ssh command will fail to authenticate, and hence return an error (255 seems to be the default return value for any error).

share|improve this answer
    
It works fine. It copies the files, just the MySQL Backup part fails –  Tiffany Walker Feb 19 '13 at 1:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.