Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are options available to get cron's results and how to set them up?

I know that default cron's behavior is to send normal and error output to cron's owner local email box.

Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ?

like image 604
paulgreg Avatar asked Sep 04 '08 08:09

paulgreg


2 Answers

To email the output to a different email address just add the line

MAILTO="[email protected]"

To the crontab before the command

like image 104
Rodney Amato Avatar answered Oct 02 '22 09:10

Rodney Amato


You could chuck file redirection onto either the command shown or the actual command in the crontab for both stdout and stderr - like command > /tmp/log.txt 2>&1 .

If you want several users to receive this log, you could insert a MAILTO=nameofmailinglist at the top of you cron file.

like image 27
Espo Avatar answered Oct 02 '22 07:10

Espo