Greg Lopp on Thu, 25 Jul 2002 14:30:10 +0200


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

Re: [PLUG] cron weirdness


from man 5 crontab :
 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.

Hence, the subject line of the message from the cron daemon 
includes your command, stopping at the first %


On Thu, Jul 25, 2002 at 10:36:58AM +0200, Jeff Abrahamson wrote:
> I put the following line in my crontab:
> 
> 17 4 * * *	/bin/tar czf archives/archive-`date "+%Y-%m-%d_%H.%M"`.tgz  gnucash-july 2> /dev/null
> 
> and go the following error:
> 
> ----- Forwarded message from Cron Daemon <root@purple.com> -----
> 
> Date: Thu, 25 Jul 2002 04:17:01 +0200
> From: root@purple.com (Cron Daemon)
> Subject: Cron <finance@diderot> /bin/tar czf archives/archive-`date "+
> To: finance@diderot.purple.com
> 
> /bin/sh: -c: line 1: unexpected EOF while looking for matching ``'
> /bin/sh: -c: line 2: syntax error: unexpected end of file
> 
> ----- End forwarded message -----
> 
> The line is fine if executed at the command prompt. I've seen this
> before with commands with embedded backticks. Anyone have a clue what
> cron/sh might be complaining about? It seems like it's truncating the
> line for some reason.
> 
> -- 
>  Jeff
> 
>  Jeff Abrahamson  <http://www.purple.com/jeff/>
> 
>  The Big Book of Misunderstanding, now in bookstores and on the web:
>  <http://www.misunderstanding.net/buystuff.html>
> 
> _________________________________________________________________________
> Philadelphia Linux Users Group        --       http://www.phillylinux.org
> Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug
_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug