On 01:55 08 Mar 2003, M.Lewis <[EMAIL PROTECTED]> wrote:
| If I run the following from the comman line, it works properly:
| 
| /bin/tar czvf /root/dbman_back-`date '+%m%d%Y%H%M'`-tar.gz \                  
| /var/www/cgi-bin/dbman
| 
| However, it I put this in my crontab, I get the following:
| 
| Subject: Cron <[EMAIL PROTECTED]> /bin/tar czvf /root/dbman_back-`date '+

Your clue is that the command stops after the "+".

| X-Cron-Env: <SHELL=/bin/bash>
| X-Cron-Env: <HOME=/root>
| X-Cron-Env: <PATH=/usr/bin:/bin>
| X-Cron-Env: <LOGNAME=root>
| 
| /bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
| /bin/bash: -c: line 2: syntax error: unexpected end of file
| 
| I realize that cron is picky about ENV and such, but I can't see what I'm 
| missing here.

Percents are special in Vixie cron crontabs. You need to slosh it:

        /bin/tar czvf /root/dbman_back-`date '+\%m\%d\%Y\%H\%M'`-tar.gz 
/var/www/cgi-bin/dbman

"man 5 crontab" says

        The  ``sixth''  field (the rest of the line) specifies the
        command to be run.  The  entire  command  portion  of  the
        line,  up to a newline or % character, will be executed by
        /bin/sh or by the shell specified in the SHELL variable of
        the  cronfile.   Percent-signs  (%) in the command, unless
        escaped with backslash (\), will be changed  into  newline
        characters, and all data after the first % will be sent to
        the command as standard input.

Cheers,
-- 
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

I became a modern day Sodomite because my teachers said it was a *harmless*
alternative lifestyle -- THEY lied through their teeth so now I'M doomed TO
HELL!!  - Doom Town . . . Chick Publication 273/G



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to