On Wed, Oct 29, 2003 at 05:46:59AM +0800, csj wrote:
| I'm having trouble getting the following to work in my crontab:
|
| 30 1 * * * mailfilter -M ~/.mailfilterrc -L ~/autosave/log/mailfilter/mailfilter-`date +%Y%m%d%H%M`.log
|
| But the following appears to work:
|
| 30 1 * * * mailfilter -M ~/.mailfilterrc -L ~/autosave/log/mailfilter/mailfilter-`date -I`.log
|
| Which however doesn't give me the nice differentiating precision
| of `date +%Y%m%d%H%M`.
It took me a long time to figure out the same problem (but with a
different command). Well, my cron job that wouldn't work was a
monthly job and so I pretty much had to wait until the next month to
test any changes.
The key is this snippet from crontab(5) :
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 crontab file. Percentsigns (%) in the command,
unless escaped with backslash (\), will be changed into newline charac
ters, and all data after the first % will be sent to the command as
standard input.
Change all '%' in your command to '\%'.
-D
--
I can do all things through Christ who strengthens me.
Philippians 4:13
http://dman13.dyndns.org/~dman/
Attachment:
pgptSCeUppzwW.pgp
Description: PGP signature