Cron job problem

Cron job problem

by Simon Trelc -
Number of replies: 11

Hello, 

I am running Moodle 3.8 (Build: 20191118).

I have a problem with cron job that used to work but not anymore and I have no idea why.

I have made a cron job, as I am attaching a screenshot. 

When I paste link that should activate cron job in my browser it gives me an error. Anyone have suggestions? I attached screenshot of the error also.

Please help me, thanks!

Attachment Screenshot_1.jpg
Attachment Screenshot_2.jpg
Average of ratings: -
In reply to Simon Trelc

Re: Cron job problem

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
For a start, do you have to use wget as opposed to running the CLI version of cron?

If you insist on the wget variety - make sure you have Debugging enabled, reproduce the problem, then check your web server's error log for the full description of the problem (hopefully)
In reply to Howard Miller

Odg: Re: Cron job problem

by Simon Trelc -
I don't know. I made cron job as I was instructed by internet forums. It was working for like 8 months and now it does not work anymore. I haven't changed anything. I have hosting on web server for my moodle, so I can't really see much of logs. Any suggestions?
In reply to Simon Trelc

Odg: Re: Cron job problem

by Simon Trelc -
Hello, my problem still persists. The cron job is ok, but hosting is set that cron jobs must execute in 60seconds. Sometimes cron job happens and sends e-mails that should have been sent a month ago. Can I clear those emails, and it just sends the ones from now on? This may be the problem why cron can't finish in 60seconds.
In reply to Simon Trelc

Re: Odg: Re: Cron job problem

by Nurbek Tentiev -
Did you try setting longer period of time? ... like 5 or 10 mins. You may also try to turn on sending cron job reports to your email to see how it works on your hosting.
Regarding purging email queue in the server, you should address this question to your hosting provider.
In reply to Nurbek Tentiev

Odg: Re: Odg: Re: Cron job problem

by Simon Trelc -
I cannot set it for longer period of time sad My hosting provider only allows up to 60 seconds. And in logs he always gets that cron job timed out. How do I turn on sending cron job reports to my mail? I already contacted my hosting provider and he says he can't do nothing. That the job doesn't finish in 60 seconds and that it is problem on my side. Also cron job executed successfully 2 times last week but all the other times it failed. It is set up that cron job runs every 15min. Anyone know anything that might help? I am really desperate and the university is putting a lot of pressure on me, because this is not working.
In reply to Simon Trelc

Re: Odg: Re: Odg: Re: Cron job problem

by Nurbek Tentiev -
Ah, ok, your cron runs every 15 min but it must be executed during 60 sec...
Did you check logs in admin interface to see tasks and which exactly are being timed out (Site administration - Server - Tasks - Task logs) ?
May be it makes sense to turn off some taks that you don't need to be executed (Site administration - Server - Tasks - Scheduled tasks).
And also try playing with manual running a cron (cronclionly and cronremotepassword in Site administration - Security - Site security settings).
In reply to Nurbek Tentiev

Odg: Re: Odg: Re: Odg: Re: Cron job problem

by Simon Trelc -
That is correct.
Yes, in task logs everything seems to be alright. Like tasks are running.
I did turn off some tasks, to check if there is too much tasks to perform a cron job in 60seconds, but the problem persists. 
If I run cron from CLI  I get this message: 

!!! error/generalexceptionmessage !!!

In reply to Simon Trelc

Re: Odg: Re: Odg: Re: Odg: Re: Cron job problem

by Nurbek Tentiev -
> If I run cron from CLI I get this message:
Please clarify, do you get that error message when you run the cron from browser or command line ?
In reply to Simon Trelc

Re: Odg: Re: Cron job problem

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

You wrote:
> I made cron job as I was instructed by internet forums.
And that was?

> It was working for like 8 months and now it does not work anymore. I haven't changed anything.
If you haven't then somebody else has. You need to know what happens inside you site.

> I have hosting on web server for my moodle, so I can't really see much of logs.
Then you are locked out. See Why in Howard's post earlier.
In reply to Visvanath Ratnaweera

Odg: Re: Odg: Re: Cron job problem

by Simon Trelc -
Instructed by forums is this: https://docs.moodle.org/38/en/Cron
Yes, I havent manually changed a thing. My moodle is automatically updating itself, so maybe that could be a problem? But I don't get it, because even if it is updated a cron job is a basic script, which I run in browser manually or set a cron task on hosting to run it every x minutes.
Well which logs will tell me where the cron job stops or where is the problem? I need to see why doesn't it finish in 60seconds, that should be enough.. Because in last week it finished twice and than nothing no more. I don't get it. The size of finished cron was 20k but the cron that can't finish is size 4k.
In reply to Simon Trelc

Re: Odg: Re: Odg: Re: Cron job problem

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> Instructed by forums is this: https://docs.moodle.org/38/en/Cron
Which one: CLI? wget? https://docs.moodle.org/38/en/Cron#Working_out_the_Moodle_cron_command

> My moodle is automatically updating itself, so maybe that could be a problem?
So the server chanes although you are not changing anything (manually)? Not that it is a problem, when everything works. When not, yes, then there is one more unknown.

> But I don't get it, because even if it is updated a cron job is a basic script, which I run in browser manually or set a cron task on hosting to run it every x minutes.
Yes, triggering the cron.php is done outside of Moodle.

> Well which logs will tell me where the cron job stops or where is the problem?
In the default CLI cron, the logs are sent to the mailbox of the user who invokes cron.php.
Average of ratings: Useful (1)