Cron- slow when manually run, won't work from a scheduled task

Cron- slow when manually run, won't work from a scheduled task

by Heather P -
Number of replies: 2

We have a Moodle 2.4.3 on a WIndows 2008 R2 server and the cron set up as a scheduled task using wget.

It was working fine.

Then we started restoring courses from a Moodle 1.9.11 and about half way through the restore of about 20 courses with a current total of about 16 users (we did not restore any users), the cron suddenly stopped working from the scheduled task. Obviously we didn't notice at the time, it was some time later and we back tracked to a 15 minute period.

The scheduled task runs, the cron is called and nothing happens. I can see it in the IIS log file

2013-04-11 02:05:20 1xx.xxx.x.xx GET /admin/cron.php - 80 - 192.168.0.22 Wget/1.10.2 401 2 5 0

If I run it manually from a browser page it takes an absolute age considering there is so little in the Moodle and its opening line is 

Created missing context instances

Cleaned up stale user sessions
Running auth crons if required...

Which begs why are the contexts missing. It doea however finish with 

Deleting trash files... done.
Cron script completed correctly
Execution took 788.943697 seconds

Now how do I make it go. I was just considering slowing the scheduled task down to see if that made a difference. 

I found a posting yesterday regarding crons and overloading the server, but I can't find it today. There was however no solution posted.

Any ideas on where to look / change etc?

I have checked permissions on the account running the cron, nothing has changed. We do have another Moodle 2.x running on this server even less in it, but its cron is running fine as a scheduled task.

Thanks

Heather

Average of ratings: -
In reply to Heather P

Re: Cron- slow when manually run, won't work from a scheduled task

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Just switch on Debugging (right up to developer) and run command line cron 'manually'. Do you get any errors? Especially just where it fails?

In reply to Howard Miller

Re: Cron- slow when manually run, won't work from a scheduled task

by Heather P -

Hi

I can run it manually from the browser no problem. If I get it to write an output from the scheduled task it never even kicks the cron off.

It seems to be something in the scheduled task not happening and I don't understand why. I have other identical scheduled tasks and they work. I even slowed it down in case it was taking too long to complete before the next one kicked off. Made no difference.

I just don't know what to do with it now. 

Thanks