Cronjob do not run

Cronjob do not run

by Emiliano Molina -
Number of replies: 3

I'm using the most recent version of Moodle (2.4+) and the cron is not executing correctly.

If a run the cron.php file from de browser it runs without problems, but when I set up a cronjob it seems not to run.

The cronjob is perfectly defined (I've talked to the support of my hosting service and they tested it; their logs show that the cronjob executes every 5 minutes) but it's not running. After 24 hours Moodle shows a message advising that cron is not executing.

What can be wrong? Something in my installation? Is it a problema of my hosting provider?

Thanks for the help.

Average of ratings: -
In reply to Emiliano Molina

Re: Cronjob do not run

by Ken Task -
Picture of Particularly helpful Moodlers

http://docs.moodle.org/24/en/Cron_with_Unix_or_Linux

shows how IF the hosting provider is running Linux.  The link above shows how to test from the command line as a root user.  If you have shell access you could test as well.  Might have to ask the hosting support people to run the command line test.

The above link does show a 'wget' method as well as a 'curl' method for running the cron job.   Those are like the browser running the cron.php link.  If you are using one of those, is the cron job behind a password?  See Site Adminisration Menu -> Security -> Site Policies

crontab is different in that it must run under the user of the apache service.   From the link above:

"Using the crontab program on Unix/Linux

Once you have selected (and tested!) an appropriate command to invoke the Moodle cron it must be added to the web users 'crontab' to schedule it to run regularly. 'Crontab' is both a file containing the user's cron commands and is also the name of the (command line) program used to edit it. Use the following command (as root) substituting the correct user in place of 'www-data' (e.g. 'apache' for Centos, 'www-data' for Debian/Ubuntu - Google will know!)"

It would be unusual, but ... if php scripts do not have enough time to complete or enough memory allocated, those could also cause cron job to fail (it is a php script).

The page above also mentions "an alternate php.ini for the CLI PHP command which may not have suitable settings".

'spirit of sharing', Ken

 

In reply to Ken Task

Re: Cronjob do not run

by Emiliano Molina -

My hosting provider has created a cronjob according those specifications. Emails are coming with this body:

Failed loading /usr/local/lib/php/20060613/ZendExtensionManager.so:  Cannot open "/usr/local/lib/php/20060613/ZendExtensionManager.so"

PHP Deprecated:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0

 

Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0 PHP Deprecated:  Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0

 

Deprecated: Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0 PHP Deprecated:  Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0

 

Deprecated: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0 PHP Deprecated:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0

 

Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0 !!! <p><strong>SECURITY WARNING!</strong></p><p> To operate properly, Moodle requires <br />that you make certain changes to your current PHP settings.</p><p>You <em>must</em> set <code>register_globals=off</code>.</p><p>This setting is controlled by editing your <code>php.ini</code>, Apache/IIS <br />configuration or <code>.htaccess</code> file.</p> !!!

What can be wrong?

In reply to Emiliano Molina

Re: Cronjob do not run

by Ken Task -
Picture of Particularly helpful Moodlers

The first errors are reporting Zend.  Not sure you can do anything about that ... hosting provider.

The last error tells you what should be done.  Here again, you may not be able to do anything about it  .... again hosting provider.

Please share what you've shared here with hosting provider.

'spirit of sharing', Ken