Linux – How to setup/change the administrator email on linux server

centoscronemaillinux

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?

Best Answer

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.