[NTLUG:Discuss] Cron Job Issues

Fred James fredjame at fredjame.cnc.net
Wed Aug 2 07:23:06 CDT 2006


Stephen Davidson wrote:

>Greetings.
>
>I am hoping that this is something reasonably routine, designed just to 
>trip up newbies.  I am trying to copy a tar ball generated by a backup 
>job from one server to another.  I only need the latest file in the 
>directory, not all of the files in the directory.
>
>So, I worked out the following command line;
>scp -p steve at j2eeguys.com:/work/backups/CVS.`date +%Y%m%d`.tgz 
>/work/sda1/backups
>
>That works from the command line.  However, when I put this in a 
>crontab, it fails????  I get mailed the following output,
>
> From steve at blue.j2eeguys.com  Wed Aug  2 01:30:03 2006
>Date: Wed, 2 Aug 2006 01:30:01 -0500
>From: root at blue.j2eeguys.com (Cron Daemon)
>To: steve at blue.j2eeguys.com
>Subject: Cron <steve at blue> scp -p 
>steve at j2eeguys.com:/work/backups/HRXCVS.`date +
>X-Cron-Env: <SHELL=/bin/sh>
>X-Cron-Env: <HOME=/home/steve>
>X-Cron-Env: <PATH=/usr/bin:/bin>
>X-Cron-Env: <LOGNAME=steve>
>X-Cron-Env: <USER=steve>
>
>/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
>/bin/sh: -c: line 1: syntax error: unexpected end of file
>
>So, any suggestions on how to fix this????  I was hoping I could just 
>drop a 'one-liner' into my crontab to do the copy.
>
>-Steve
>
>  
>
Stephen Davidson
All else being equal, my first thought is quoting - the shell may be 
interrupting something in a way you do not wish.  You could try 
"quoting" certain characters with a backslash (example \+ or \%, 
although I cannot promise those are the one that need it).  Hope that helps
Regards
Fred James





More information about the Discuss mailing list