CRON schedule failing...?

CRON schedule failing...?

by Gary Newport -
Number of replies: 3

Obviously, as per the title, the scheduled CRON tasks are failing.

If I run them via the command line it runs through without issue, but if I go to the task logs I can see that all the scheduled runs have failed.

If I go to a failed log I get this (regardless of which one I choose)...

Execute scheduled task: Legacy cron processing for plugins (core\task\legacy_plugin_cron_task)
... started 10:44:02. Current memory use 16.5MB.
Running auth crons if required...
Running enrol crons if required...
Starting activity modules
Processing module function journal_cron ...
... used 2 dbqueries
... used 0.010889053344727 seconds
done.
Finished activity modules
Starting blocks

Clearly, it is stopping at blocks but how might I find out what is causing this?



Average of ratings: -
In reply to Gary Newport

Re: CRON schedule failing...?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Switch on Debugging (all the way to Developer)

How are you running cron? It should be exactly the same running them 'manually' as from a cron script. Different user possibly?
In reply to Howard Miller

Re: CRON schedule failing...?

by Gary Newport -
Not sure how I would find this out (in terms of different user).

Does running the cron job via the web browser recognise the fact that I am logged on through another tab?
I am assuming that the original scheduled tasks were set to run under the admin account (which is unused by anyone), whilst I log on with my own account (which has admin rights).

I did find that at least one folder had a permissions error on it. Since running the web browser version the scheduler appears to be running successfully. I also fixed the folder permissions on the server just after the successful web browser run, so maybe that was the issue?
In reply to Gary Newport

Re: CRON schedule failing...?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
One of us is confused....

I have no idea what your operating system is but you should not (unless there's no other way) be running cron through the web server. If you have command line access then run it as a normal cron script. However, it's important that you run as the same (operating system) user as the web server or you will definitely hit problems with file permissions. None of this is anything to do with Moodle users.