Linux – How to get the cron daemon to send me email when a job fails with an error

cronemaillinuxUbuntu

I have a few Ubuntu boxes that run various cron jobs daily. As far as I know, there is no postfix or sendmail installed. What's the easiest and/or best way to get cron to send me an email when one of its jobs fail with an error?

Thanks!

Best Answer

cron notifies root by default, this is local user mail delivery only.

If you want to send emails to user@gmail.com, then install postfix (defaut conf with listen on localhost only) and modifies /etc/aliases to forward emails to root to user@gmail.com. Then run

postaliases /etc/aliases

and you're all set