root's crontab looks something like this...
SHELL=/bin/bash
MAILTO=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
rsync=/usr/bin/rsync -e ssh -azv --delete --delete-excluded --exclude=/some/folder root@serverA::home /home/
7 */2 * * * $rsync > /root/rsync_`/bin/date +%m%d`"_"`/bin/date +%Tp`.txt
The problem is redirecting the output to the above file name. If I manually run that command from the shell, it works fine and creates a file called something like /root/rsync_1009_00:58:09p.txt. When I run it from a cron job, it fails and the job doesn't run. This is the error...
/bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
/bin/bash: -c: line 2: syntax error: unexpected end of file
If I do a simple redirect without the date command, it works fine. For example, $rsync > somefile.txt works no problem from cron.
Thanks,
Chris
SHELL=/bin/bash
MAILTO=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
rsync=/usr/bin/rsync -e ssh -azv --delete --delete-excluded --exclude=/some/folder root@serverA::home /home/
7 */2 * * * $rsync > /root/rsync_`/bin/date +%m%d`"_"`/bin/date +%Tp`.txt
The problem is redirecting the output to the above file name. If I manually run that command from the shell, it works fine and creates a file called something like /root/rsync_1009_00:58:09p.txt. When I run it from a cron job, it fails and the job doesn't run. This is the error...
/bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
/bin/bash: -c: line 2: syntax error: unexpected end of file
If I do a simple redirect without the date command, it works fine. For example, $rsync > somefile.txt works no problem from cron.
Thanks,
Chris