Difference between revisions of "Cron"

From wiki
(Created page with "== Setup Notifications == By default email sent from cron will go to <code><username>@<hostname></code> which is a bit of a pain to setup mail filters when you get multiple ma...")
 
(Categories)
 
Line 7: Line 7:
  
 
'''Note:''' You need to add this line in all crontab files. This mean <code>/etc/anacrontab</code> if it exist as well as users crontab.
 
'''Note:''' You need to add this line in all crontab files. This mean <code>/etc/anacrontab</code> if it exist as well as users crontab.
 +
[[Category:Linux Server]]
 +
[[Category:Linux Desktop]]

Latest revision as of 09:39, 2 April 2016

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.