Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple cron job entries configured under a single account:

0 0 * * * /foo/foo.sh
0 2 * * * /foo/foo2.sh
0 4 * * * /foo/foo3.sh

Right now, if any of these encounter an error, an email is sent to the user account. Can I configure cron to send a notification to a different email address depending on which entry encounters the error?

For example, if an error occurs while running /foo/foo.sh send to bob@bob.com. If an error occurs while running /foo/foo2.sh send to joe@joe.com.

I know I can set MAILTO=someaddress@example.com but I think that's for ALL cron entries (for the account I'm logged in as)... I don't think that's a per-entry setting.

Hopefully this makes sense. Thanks. :-)

share|improve this question
up vote 6 down vote accepted

It it perfectly Ok to use MAILTO= per-entry, i.e.:

0  0 * * * /foo/foo.sh
0  2 * * * /foo/foo2.sh
0  4 * * * /foo/foo3.sh
0  6 * * * /foo/foo4.sh
0  8 * * * /foo/foo5.sh
0 10 * * * /foo/foo6.sh

And so on.


share|improve this answer
Ah, I didn't know that was possible. That's exactly what I'm looking for. Thank you! – Mike B Aug 29 '14 at 16:13

I am not sure if this is what you are looking for. From that answer, I see it as,

* * * ...  your cron job
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.