Reciece e-mail when running cronjob

Cyberboy

Verified User
Joined
May 16, 2004
Messages
29
Recieve e-mail when running cronjob

Hello,

Everytime when a cronjob is running, I will recieve an e-mail with the details. Beceause there are running 100 cronjobs every hour, I recieve 100 e-mails every hour.

Is there a possibility to configure this?

Thanks in advance,
Rick
 
Last edited:
Cronjobs mail the job output to the user running the cronjob.

To keep it from happening, call the job with a redirect to redirect all output to /dev/null.

For example, if you were going to send a directory listing to yourself from a cronjob you might call:

ls

To keep the output from being sent to the user running the job you'd call:

ls > /dev/null

This would still send you any errors. If you don't want the errors you'd try something like this:

ls > /dev/null 2>&1

Jeff
 
You can use this creatively... for example you can pipe the output to a file, then grep the file, and only send you an email if something in the file is set; we do this to send us copies of "/dev/mdstat" only if one of our RAIDs is broken.

Jeff
 
What I meant was instead of piping it to /dev/null you could pipe it to a file, then run another script to manage the file and do something with it based on the contents.

Jeff
 
Back
Top