2

Supposedly, if you install a cron and the cron job has an output >/dev/null, it will be sent to the system administrator. Is this true? Where does the email get setup? I don't see anything in /etc/mail.rc on this and there is nothing about mail in the crontab either.

Help?

migrated from stackoverflow.com Aug 20 '11 at 0:53

This question came from our site for professional and enthusiast programmers.

5

The output will, by default, get sent to whichever user's crontab started the process. If this is the main crontab, then root gets the email.

If you want the mail sent somewhere else, you can either configure your MTA to forward the mail, or set MAILTO from within the crontab to alter the destination. (Use MAILTO="" to suppress mail entirely.)

if you install a cron and the cron job has an output >/dev/null, it will be sent to the system administrator

I believe you meant to say that the job does not have output redirected to /dev/null; if all of the output is written to stdout, and stdout gets sent to /dev/null, then there will be no output to send to anyone.

  • Will specifying MAILTO="myemailaddress@someplace.com" within the crontab override sending to the system adminstrator? If not, how do I overrride the system admin email? – syn4k Aug 19 '11 at 22:23
  • Yes, it would. You would "override" the system admin email by configuring the MTA to forward mail destined for root to another address. – cdhowie Aug 19 '11 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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