The cron.php maintenance script has not been run for at least 24 hours.

The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -
Number of replies: 14

I have been researching for days but cannot fix this issue.


I did a quick install through Hostgator and then updated Moodle myself to the newest version. It all seems to be working fine, however it keeps saying "The cron.php maintenance script has not been run for at least 24 hours."


I currently have cron running every 15 minutes using:


"/usr/bin/php /public_html/online/admin/cli/cron.php >/dev/null"

but have also tried

"www-data cd /public_html/online/admin/cli/; /usr/bin/php cron.php >/dev/null"


When I go to www.prestigemedical.org/public_html/online/admin/cli/cron.php all I get is a 404 not found message. I am using that command because i found it in the Moodle documents. I have also confirmed that the cron.php file is in that location.


Any help would be much appreciated.


Thanks!





Average of ratings: -
In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Ricardo Grandón -

hi alexander


u have a wrong url, use this

http://prestigemedical.org/online/admin/cron.php

usage of "/cli" is not supported for u host, but if you use directly "admin/cron.php" emulate them

but u need use config pass in crontab

for ex

*/15 * * * * /usr/bin/php  /path/to/moodle/admin/cron.php?password=userpass >/dev/null

see


https://docs.moodle.org/22/en/Cron


In reply to Ricardo Grandón

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

Hello Ricardo,


Thank you for the quick reply, however, I am still having an issue.


I used the command

/usr/bin/php /online/admin/cron.php?password=mypassword>/dev/null


I entered the same password in "site policies --> "Cron password for remote access". Was that the correct way? It still gives me the same error The cron.php maintenance script has not been run for at least 24 hours.


Also, if I go to http://prestigemedical.org/online/admin/cron.php it says "!!! Sorry, you have not provided a valid password to access this page !!!"


That pass word error was happening even before I entered a password in site policies.

In reply to Ricardo Grandón

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Bret Miller -
Picture of Particularly helpful Moodlers

Perhaps you should remove the >/dev/null and see what the output is... that might give you a hint if something is wrong.

In reply to Bret Miller

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

Hey Bret,


I removed that so now the command reads:


/usr/bin/php  /online/admin/cron.php?password=mypassword


However it still is giving me the error. Was there something else I should have done after removing >/dev/null?


Sorry for all the questions, I am new to all this.. 

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Bret Miller -
Picture of Particularly helpful Moodlers

Well, on my server, it would email me the results... I was hoping we could tell from that what was causing the cron scripts to fail. If you have command-line access to the server (like via ssh), try running the command manually to see if an error shows in the results.

If not, you could add > /home/your-user-name/cron.log to the end and it should create a file with the last result of the cron job that you can view.

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Ricardo Grandón -
Hi again

u change password in commnad line ???

go to

  Home
    / ► Site administration
    / ► Security
    / ► Site policies

and change password for "Cron password for remote access"
cron
empty password for a test and save.
use command

/usr/bin/php  /path/to/moodle/admin/cli/cron.php
and "magic" or paste results.


In reply to Ricardo Grandón

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

I had my email on it, but I was getting emails way too often so I took it off.


The emails looked like this:


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0    50    0    50    0     0    155      0 --:--:-- --:--:-- --:--:--   155

  0    50    0    50    0     0    147      0 --:--:-- --:--:-- --:--:--   147

Moodle upgrade pending, cron execution suspended.


OR


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0    74    0    74    0     0    145      0 --:--:-- --:--:-- --:--:--   145

  0    74    0    74    0     0    138      0 --:--:-- --:--:-- --:--:--   139

!!! Sorry, you have not provided a valid password to access this page !!!

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

I feel like I am doing something wrong with the password and command line. I keep seeing all these different ways to write the command and am not sure which I am supposed to be using?


As far as the password, am I supposed to put it somewhere else? I don't even remember making a password for it, it is just the username password right?


I see the password is in the config.php file which is in my Moodle folder. I saw the wp-config file in the root folder, but that has a different username and password as I have a separate user for Wordpress.


I put the password from the config.php file into Moodle when I went to site policies - cron password.


What else is there to do?

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

I think I did it... I went through the Moodle Docs again and used the command:


/usr/bin/php /online/admin/cli/cron.php >/dev/null


I removed the password from Moodle site policy.


After that, I went on 


http://prestigemedical.org/online/admin/cron.php


And there I can see the entire cron job.


Do I have to have a password now, or is it fine just like that?

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

Actually, the emails are showing:

PHP:  syntax error, unexpected '(' in /home3/aquesada/php.ini on line 506 Failed loading /opt/ioncube/ioncube_loader_lin_5.5.so:  /opt/ioncube/ioncube_loader_lin_5.5.so: undefined symbol: zend_execute_ex

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Damyon Wiese -
Well - it looks like your php is misconfigured in cli mode on the server (/home3/aquesada/php.ini on line 506).

You either fix this error, or work around it. The workaround is to run a script to load the cron through apache instead of running it directly.



*/15 * * * * /usr/bin/curl http://prestigemedical.org/online/admin/cron.php >/dev/null



The "Password for remote access" is only needed when running cron through apache (ie loading the cron page in a browser). If you set a password in the admin settings, then you need to modify the above command by adding ?password=secret



*/15 * * * * /usr/bin/curl http://prestigemedical.org/online/admin/cron.php?password=secret >/dev/null

Average of ratings: Useful (1)
In reply to Damyon Wiese

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Damyon Wiese -
Also - note if you are on the latest Moodle version you should be running cron every 1 minute - not every 15 minutes.
Average of ratings: Useful (1)
In reply to Damyon Wiese

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

Hey Damyon,


Thanks for the assistance, i'm pulling my hair out over here.. Definitely couldn't figure all this out without all your guys help!


So I have no idea how to fix it, the only thing line 506 says is:


Line 505 - ; Default timeout for 

Line 506 - based streams (seconds)

Line 507 - default_socket_timeout = 600


I used the command you gave me:


/usr/bin/curl http://prestigemedical.org/online/admin/cron.php >/dev/null


and made it every 1 minute.



How do I know it is working, though?

In reply to Alexander Quesada

Re: The cron.php maintenance script has not been run for at least 24 hours.

by Alexander Quesada -

This is what the email says:


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

105  1688    0  1688    0     0   1949      0 --:--:-- --:--:-- --:--:--  1951

100  4713    0  4713    0     0   4351      0 --:--:--  0:00:01 --:--:--  4359


I have since turned the email off, receiving it every minute is a bit much..