Fedora 14 - cron job sending emails every 5 minues.

Fedora 14 - cron job sending emails every 5 minues.

von Jerry Lumpkins -
Anzahl Antworten: 1

Hi,

I'm experiementing with Moodle 1.9.11 on a Fedora 14 server, and found the installation and setup process to be a breeze. I had it up and working in way under an hour.

But, I've spent hours looking for how to turn OFF the email that gets sent to my apache user every 5 minutes. (Every time the cron job runs.) After looking around I finally figured out what was going wrong. The default install of Moodle on Fedora creates an executable file: /usr/sbin/moodle-cron that is then executed by the cron process every 5 minutes. /usr/sbin/moodle calls /usr/bin/php /var/www/moodle/web/admin/cron.php which has output. Any time a cron job has output, it emails the owner of the process, which in this case is apache (my webserver user). Since I really have no need to receive an email every 5 minutes to tell me that a process did what it was supposed to do, I really didn't want those emails. The trick is (after looking at the instructions on how to set up cron in your documentation) to redirect the output of /usr/sbin/moodle-cron to /dev/null. i.e.: [ -f /var/lock/subsys/moodle ] && [ -f /var/lock/subsys/httpd ] && /usr/bin/php /var/www/moodle/web/admin/cron.php > /dev/null

This causes the output from the process to be absorbed by /dev/null, and cron doesn't keep sending unnecesary emails. I know that if one were to follow the directions shown on your page to setting up cron, this wouldn't have happened because the call to wget has the -O /dev/null (send output to /dev/null) in it, but, if you do a default installation through yum, the calls are already set up. It would be nice if someone would change the default behavior of yum installer so that the installation doesn't leave the user wondering all over the web trying to figure out how to turn off the obnoxious emails.

Take care, and maybe this will save someone the hours of research it took me to solve it.

Jerry Lumpkins

Als Antwort auf Jerry Lumpkins

Re: Fedora 14 - cron job sending emails every 5 minues.

von Visvanath Ratnaweera -
Nutzerbild von Particularly helpful Moodlers Nutzerbild von Translators
Hi Jerry

> I'm experiementing with Moodle 1.9.11 on a Fedora 14 server, and found the installation and setup process to be a breeze. I had it up and working in way under an hour.
>
> But, I've spent hours looking for how to turn OFF the email that gets sent to my apache user every 5 minutes ...

Another case for the general advice against the packaged version of Moodle from the (Linux) distribution. If you have installed as documented here http://docs.moodle.org/en/Installing_Moodle you couldn´t have missed the section ´Set up cron´ which is linked to http://docs.moodle.org/en/Cron