Hi,
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)
# clean up postmaster 00 30 * * * root /usr/bin/find /var/qmail/maildirs/postmaster@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
The mind boggles...
Any help would be appreciated.
Warm Regards, Mário Gamito
On 3/23/07, Mário Gamito gamito@gmail.com wrote:
Hi,
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@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.
Jim Perrin wrote:
On 3/23/07, Mário Gamito gamito@gmail.com wrote:
Hi,
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@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@bilby ~]$ mkdir /tmp/x@j [summer@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 crontab -e and ensure I have a line MAILTO=me@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.
Hi,
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@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
Of course that in the command shell i only run: $ /usr/bin/find /var/qmail/maildirs/postmaster@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
Warm Regards, Mário Gamito
Mario:
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)
# clean up postmaster 00 30 * * * root /usr/bin/find /var/qmail/maildirs/ postmaster@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
If that is the actual crontab entry, then it is not valid, as the second column is the hour (there is no hour 30). You probably want this:
30 00 * * * root /usr/bin/find /var/qmail/maildirs/ postmaster@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
Alfred
Hi,
# clean up postmaster 00 30 * * * root /usr/bin/find /var/qmail/maildirs/postmaster@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
If that is the actual crontab entry, then it is not valid, as the second column is the hour (there is no hour 30). You probably want this:
30 00 * * * root /usr/bin/find /var/qmail/maildirs/postmaster@telbit.pt/Maildir/new -type f -print0 | xargs -0 -n 50 rm
I'm getting old, i guess :(
Warm regards