Moodle scheduled tasks

Moodle scheduled tasks

by Levente Vass -
Number of replies: 12

Hi, I have a problem with the scheduled tasks. I am not the one who hosts the Moodle, I am just an administrator. I changed "Path to CLI" to "/usr/bin/php", but when I clicked on "Run now" an error message popped up (!!! error/generalexceptionmessage !!!). Then I tried to use "C:\php\php.exe" but this time not even "run now" option was there. Can I change path to CLi as an administrator or do I ask the one who hosts?

Average of ratings: -
In reply to Levente Vass

Re: Moodle scheduled tasks

by Ken Task -
Picture of Particularly helpful Moodlers

Suggest you find out what operating system you are running:

Site Admin Menu -> Server -> PHPinfo

First line in the resulting screen says System:

The paths you see in the system paths setting screen are 'suggestions' ... for some.   Do you see any other paths set on that screen ... like for GhostScript?  If they all show /usr/bin/something ... it's a linux server - linux servers don't know about C:\ ... that's a Windows thing.

So set it back to /usr/bin/php ... then go to scheduled task again.   Links to 'run now' there?

The error you saw might be about just the scheduled task you choose.   Have you tried other 'run now' links to see if they produce the same error?

'SoS', Ken

In reply to Ken Task

Tárgy: Re: Moodle scheduled tasks

by Levente Vass -
I see "/etc/php/7.4/" and things like this, so I suppose it's Linux, right? I set it back to "usr/bin/php" and now there is Run now, but I get the same error message on every task I try to run.
In reply to Levente Vass

Re: Tárgy: Re: Moodle scheduled tasks

by Ken Task -
Picture of Particularly helpful Moodlers

First line of phpinfo should be system.

Yes, by what you have shred back ... /etc/php/7.4' does look like a linux.

If you set back to 'usr/bin/php' ... you missed the begining '/'.  Should look like '/usr/bin/php'

So every task using 'run now' rendering same error.

There is another setting that must be on (checked):

in Site Admin Menu -> Security -> Site Security Settings

Allow 'Run now' for scheduled tasks box has to be checked ... ie, on.

Then TIA (try it again).

If that does not work, turn on debugging to see what else Moodle might tell ya!

'SoS', Ken

In reply to Ken Task

Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Levente Vass -
I set it to /usr/bin/php, and I allowed Run Now feature and I got the same error. I set the debugging to "Developer" and I enabled "Display debug messages" but when I try to Run Now I get only "!!! error/generalexceptionmessage !!!", nothing else. Am I missing something?
In reply to Levente Vass

Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Ken Task -
Picture of Particularly helpful Moodlers

Is there a 'check' next to the box for path to php-cli?  See screenshot attached.

If not, wrong path to php-cli?  You've not shared what operating system you have ... Linux we know, but there are distributions of linuxes - again phpinfo page at the top will tell you and you could share back here that info.

Go to Notifications ... is it complaining cron job hasn't run there?

The cron job is actually set outside of moodle config ... at the operating system (which you still haven't shared back) level.   If you know who admins the backend contact them and ask if he/she could send you a screen shot of the cron job for the moodle.   That will show the path to php-cli.

Good hosting providers normally have FAQ's and how-2's for customers.  If you know where the moodle is hosted, check those for how to setup cron jobs.   That should give you more info about the path to php-cli.  Google for that info.

'SoS', Ken

Attachment Screen Shot 2021-08-14 at 10.42.15 PM.png
In reply to Ken Task

Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Levente Vass -

Thank you, I will contact the provider. So maybe the host didn't configure cron properly and that's the trouble?

Attachment Névtelen (1).png
Attachment Névtelen (2).png
Attachment Névtelen.png
In reply to Levente Vass

Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You need to speak to your hosting company. The path looks correct but, for some reason, the PHP cli isn't working. This isn't something you'll sort out with Moodle settings.
In reply to Howard Miller

Tárgy: Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Levente Vass -
Can a plugin break scheduled tasks?
In reply to Levente Vass

Tárgy: Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Levente Vass -
I disabled every additional plugin, so I suppose it has nothing to do with plugins, right?
In reply to Levente Vass

Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Ken Task -
Picture of Particularly helpful Moodlers

2 with one response ... maybe ... 'can a plugin break scheduled task' ... possible, but not really 'break' in the sense of throw errors.

Disabling all additional plugins and still having an issue with scheduled task isn't an indication of 'plugin issues' cause in reality, moodle consist of nothing but plugins ... called core.  A theme is a plugin (core) + one could install additonal themes (addons/additional).

So the issue is still present? ... cannot use 'run now' link on all scheduled task?

Your screen shots showed cron job had never run.  Did you get that setup/resolved?

Reason: the cron job for site includes those scheduled task that are active.   Not only that, but in higher versions of Moodle there is a thing called 'ad_hoc_task' ... which is a que of scheduled task that did not complete for some reason ... they run later again to try and finish/complete whatever they do.

So if the main cron job has been off/not configured, your moodle is building up a lot to catch up on.  Takes longer to processs whatever and, of course, also uses up resources trying to complete them all.

Go to Site Admin Notifications .... is it still complaining about running of cron?

'SoS', Ken

In reply to Levente Vass

Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Ken Task -
Picture of Particularly helpful Moodlers

Your screen shots show cron has never been run.  Has that been resolved?

Know this isn't answering latest question, but related ... did you get the php path issue resolved?

'SoS', Ken

In reply to Ken Task

Tárgy: Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Tárgy: Re: Moodle scheduled tasks

by Levente Vass -
Thank for your help, it has been solved. The path was not correct. Thank you again.