crontab entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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_%I%M%p`

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_1010_1257PM.  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



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux