Forums | Mahara Community

Support /
How to deactivate Cron email


Eric Simard's profile picture
Posts: 11

13 November 2015, 3:24

Good morning!

We just installed Mahara for our moodle, All is working great, but the cron that is schedule to run every minute on the Linux host also sends an email every minutes..... That is a lot of email in 1 day. Can that be adjusted to not email?

Thank you.

Kristina Hoeppner's profile picture
Posts: 4755

13 November 2015, 5:52

Hello Eric,

Did you have a look at https://wiki.mahara.org/wiki/System_Administrator's_Guide/Cron_Job for setting up your cron and https://wiki.mahara.org/wiki/Developer_Area/Cron_API for some more information? I can't find the word "email" mentioned on either page, and it's the first time I hear that the cron job sends an email. What sort of emails are sent? Do you have some customization done?

Cheers

Kristina

 

Edits to this post:

Aaron Wells's profile picture
Posts: 896

13 November 2015, 10:05

Hi Eric,

Specifically, if you're getting what looks like a system email every time the cron run (perhaps from a "root" email address such as "[email protected]") then it's because your cron task is generating output to STDOUT or STDERR. The Linux cron program will take any output from a cron task, and email it to the Linux user who the task is run as (which for Mahara is often root).

If that's the case, the fix is to make sure your cron specification pipes STDOUT and STDERR to a file, or to /dev/null. I notice that in the page Kristina linked to in the Administrator's Guide for setting up the cron job, we had the CLI version of the cron job piping its output to a log file, but we didn't have the curl version piping its output anywhere. So, I added the instructions there.

The important part of it is that the ending of your cron line should look like this:

>> /dev/null 2>&1

Or this:

>> /path/to/mahara/cron.log 2>&1

(Of course replace "/path/to/mahara/cron.log" with a real file location on your system.) The ">>" bit pipes STDOUT to the specified location. The "2>&1" part pipes STDERR to the same location as STDOUT.

Cheers,

Aaron

Eric Simard's profile picture
Posts: 11

17 November 2015, 4:49

Well thank you for the solution, which as i was reading memory came back and you are right about the cron.

Thank you very much well appreciated.

4 results