[NTLUG:Discuss] Cron Job Issues
Michael Barnes
barnmichael at gmail.com
Wed Aug 2 12:19:21 CDT 2006
Stephen Davidson told me on 8/2/2006 6:55 AM:
> 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
>
I ran into this a while back with a similar process. I had to define a
variable with the date info. Sorry for the multiline script.
Michael
More information about the Discuss
mailing list