Re: Silent Cron Jobs
On Wed, Mar 26, 2008 at 10:05 AM, Curt Howland <Howland@priss.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> I tried to whip up a small cron job, I put a short script
> in /etc/cron.daily thinking that this would work.
> Well, yes, it works, but I get mail sent to me by cron explaining that
> the job executed successfully.
> I'd prefer not to get the mail. I don't get mail for any of the other
> jobs in cron.daily, and I don't understand enough of bash scripting
> to see how mine is different from the others.
>From the cron manpage:
"When executing commands, any output is mailed to the owner of
the crontab (or to the user named in the MAILTO environment variable
in the crontab, if such exists)."
So, either suppress output with something like 'cmd >/dev/null 2>&1'
or put 'MAILTO=""' in the script. I think :)