I have a couple of backups that run overnight which use rdiff-backup to send files to a remote system.
The crontab (as shown by 'crontab -l') entry is as follows:-
25 03 * * * rdiff-backup --remote-schema 'ssh -C %s /home/isbd/bin/rdiff-backup --server' isbd@shell.gradwell.net::. /rdiffBackup/gradwell
If I run the rdiff-backup from the command line (copy and paste the above excluding the '25 03 * * * ' then it runs perfectly without errors.
However the cron job is failing and sending me the following mail:-
/bin/sh: -c: line 0: unexpected EOF while looking for matching `'' /bin/sh: -c: line 1: syntax error: unexpected end of file
So what's going wrong? It's almost as if the line is too long for cron but it's not *that* long. I have checked thoroughly that it really *is* one line. How can I diagnose what's going wrong?
Other entries in the same crontab are working OK.
On Tue, May 13, 2008 at 09:41:08PM +0100, Chris G wrote:
I have a couple of backups that run overnight which use rdiff-backup to send files to a remote system.
The crontab (as shown by 'crontab -l') entry is as follows:-
25 03 * * * rdiff-backup --remote-schema 'ssh -C %s /home/isbd/bin/rdiff-backup --server' isbd@shell.gradwell.net::. /rdiffBackup/gradwell
If I run the rdiff-backup from the command line (copy and paste the above excluding the '25 03 * * * ' then it runs perfectly without errors.
However the cron job is failing and sending me the following mail:-
/bin/sh: -c: line 0: unexpected EOF while looking for matching `'' /bin/sh: -c: line 1: syntax error: unexpected end of file
Why do I always find the error just after I ask about it here! It's not a quoting problem, it's that %. % is special in a crontab (see 'man 5 crontab') and needs to be escaped if you want a real %.
Chris G cl@isbd.net wrote:
However the cron job is failing and sending me the following mail:-
/bin/sh: -c: line 0: unexpected EOF while looking for matching `'' /bin/sh: -c: line 1: syntax error: unexpected end of file
So what's going wrong? It's almost as if the line is too long for cron but it's not *that* long. I have checked thoroughly that it really *is* one line. How can I diagnose what's going wrong?
Some crons seem to have a really short limit. I guess you could diagnose it if you run cron in a strace, but I'd just ignore it: put the complex command in a script and call that from crontab instead.
Hope that helps,