Cron

From wiki
Revision as of 09:39, 2 April 2016 by Vincent (talk | contribs) (Categories)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Setup Notifications

By default email sent from cron will go to <username>@<hostname> which is a bit of a pain to setup mail filters when you get multiple machines and multiple usernames.

The solution is to add near the top of the /etc/crontab

MAILTO=logs-cron-myserver@example.com

This apply to all crontab entries bellow this line. Which mean that you can get per entry email by having multiple MAILTO lines.

Note: You need to add this line in all crontab files. This mean /etc/anacrontab if it exist as well as users crontab.