2010-04-25

Cron

If you want to launch script periodically, you'll have to use cron (manual pages are well done). And the ouput of your script, if any, will be sent to the user the cron entry belongs to.

Now i added some script in /etc/cron.daily and i never received any mail from those ones. The user running the script was root, and the script was indeed generating output.

The trick is, you have to specifically add, in the case of /etc/cron.daily, /etc/cron.hourly and the other ones, the following line to your script :

MAILTO=root

if you want the result sent to root (or any other user/email assuming you set a MTA agent with a relayhost on your box, like postfix).

No comments:

Post a Comment