Cron Job - date command problem

Hi

I have one problem with cron job in Control Panel.
I have a log file that is created once a day on another server and I need to transfer it in an exact time to my server so I wrote the cron job for it BUT the problem is in the date command:

/filelog-`date +%Y-%m-%d`.tar.gz;

The file name is filelog-2013-01-04 and every day there is a new with a new date on it. But the problem is in my date command, it puts out an error:

/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file

I need somebody to help me figure out where is the problem?

Thanks!

The percent sign is interpreted as end of line in a crontab. Some implementations of cron allow to escape the percent sign with a backslash. If this doesn't work, then write a small shell script with the date command and call that script from crontab.

1 Like