Re: Silent Cron Jobs
afaik cron (by default) mails all output from a script. If i create a
cronjob I usually dump all stdout (just redirect it to /dev/null)
But I want to be informed of any errors so I keep stderr.
# this will get mailed
echo "My cool cron script"
# this will not mail stdout, but stderr (see below for an example)
echo "My cooler cron script" > /dev/null
# this will send you a mail because there was output on stderr, if
there was output on stdout it wouldn't mail
/nonexistant/echo "My failing cron script" > /dev/null
Not this is untested and just a quick writeup but the general rule should apply
On Wed, Mar 26, 2008 at 3:05 PM, 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.
> If all else fails I could just add a line to /etc/crontab, but I think
> the Debian way is so very much better coordinated and elegant.
> - --
> Treason! http://blog.mises.org/archives/007926.asp
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> -----END PGP SIGNATURE-----
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact email@example.com
You are not free to read this message,
by doing so, you have violated my licence
and are required to urinate publicly. Thank you.