[CentOS] Command not running in crontab
debian at herakles.homelinux.org
Fri Mar 23 11:53:53 UTC 2007
Jim Perrin wrote:
> On 3/23/07, Mário Gamito <gamito at gmail.com> wrote:
>> Can anoyone tell me why this command is not executed (or it is without
>> success) from crontab, but works perfectly from the command line ?
>> (yes, i've restarted crontab service)
> It works from the command line? that's kind of surprising. It may work
> via tab completion in the shell, but will not work with that as typed.
> You'd suffer from shell expansion.
>> # clean up postmaster
>> 00 30 * * * root /usr/bin/find
>> /var/qmail/maildirs/postmaster at telbit.pt/Maildir/new -type f -print0 |
>> xargs -0 -n 50 rm
> You very likely need to escape the @ as the shell is probably trying
> to do something with it.
It's true that, using tab-completion, the @ can get escaped, but I can't
find that bash actually does anything with it in this context:
[summer at bilby ~]$ mkdir /tmp/x at j
[summer at bilby ~]$ mkdir /tmp/x\@j/
The second, I used tab-completion to expand from "/tmp/x." As you can
see, it was used as typed.
I would first, check the logs.
I generally use the user's crontab, so
and ensure I have a line
MAILTO=me at example.lan
so I get the results mailed to me. It's good to set PATH too.
I also have had bad experiences (one day I will complain to someone's
bugzilla) with crond eating stuff. This does not work:
0 * * * * echo $(date)
The workaround is to put the command(s) into a script.
1aaaaaaa at coco.merseine.nu Z1aaaaaaa at coco.merseine.nu
Please do not reply off-list
More information about the CentOS