cron job help

cron job help

by David Maldonado -
Number of replies: 2

Greetings Moodlers,

I have a little problem. I have my server setup and happy. However, it sends me a blank e-mail every time cron runs. How can I configure it so that it does not e-mail me and the other site admins every time cron runs without messing with the e-mails I do want such as course backup stats?


Thanks!
DM

Average of ratings: -
In reply to David Maldonado

Re: cron job help

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
If cron should not send e-mail
a) you could add " >/dev/null 2>&1" to the end of the line in crontab
b) or put "/path/to/a_log_file 2>&1" to have the out put recorded in a file
c) or you can create a MAILTO variable and point it to whatever kind of mailbox, i.e. "MAILTO=somemailbox@example.com" in a new line above the timing line in "crontab -e"

Of course you can also combine these effects.

P.S. https://docs.moodle.org/en/Cron#Finding_the_right_place_to_put_the_command says just ">/dev/null" without combining the error stream with "2>&1". Any particular reason?
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: cron job help

by David Maldonado -

Thanks Visvanath,

This little line here took care of me:

*/1 * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php -o /dev/null -silent



Cheers!
DM