Forums | Mahara Community

Support /
Skipping long-running cron jobs


26 February 2016, 9:49 PM

My mahara (15.10) can't run cron propertly, it always shows Cron is not running.

I try to launch manually with php lib/cron.php but I get this warning:

[INF] 09 (lib/cron.php:31) ---------- cron running Fri, 26 Feb 2016 09:17:31 +0100 ----------
[INF] 09 (lib/cron.php:501) Skipping long-running cron job core_cron_site_data_daily (Thu, 25 Feb 2016 09:25:03 +0100).
[INF] 09 (lib/cron.php:501) Skipping long-running cron job core_cron_institution_data_daily (Thu, 25 Feb 2016 09:35:02 +0100).
[INF] 09 (lib/cron.php:168) ---------- cron finished Fri, 26 Feb 2016 09:17:31 +0100 ----------

I've got this line in crontab:

*/5 * * * *  nice /usr/bin/php -f /var/www/html/mahara/lib/cron.php >> /var/log/evlt/portafolio_cron.log 2>&1

Robert Lyon's profile picture
Posts: 516

29 February 2016, 9:17 AM

Hi Jesús,

Whenever a cron option is run it adds a line to the config table in the database.

To indicate to the cron run that the option is already begun so don't begin it again.

When the cron option finishes it removes the line from the config table.

If an cron option has failed at some point during it's run the line in the config table will be still there, hence the 'Skipping long-running cron job' lines in the logs.

To find and remove the lines from the config we need to find the fields in config table that start with an underscore, like so:

  SELECT * FROM config WHERE field LIKE '\_%';

And when we are happy we are removing the right stuff we remove the lines

 DELETE FROM config WHERE field LIKE '\_%';

This should allow those cron options to be run again.

The best thing to do would be to watch the logs after removing those lines to see if there are indeed something wrong with the site that is causing the cron options to fail.

If they fail again please paste the relating error log info

Cheers

Robert

 

zz s's profile picture
Posts: 9

04 March 2016, 6:56 PM

I think that i have identified the problem, however ,there is no way for me to resolve it.

we did find two tables after the " SELECT * FROM config WHERE field LIKE '\_%';" and delete it using the sql command you recommended.
here is what we found:
"_cron_lock_core_cron_institution_data_daily 1456988761
_cron_lock_core_cron_site_data_daily 1456988701
"

also, we need to modified config table ,especially for the value in the table of "cron(following the config table)";

we resolve the problem temporarily by setting the value ahead of the current time, it works before next running time in
""23 cron_institution_data_daily 2016-03-03 15:05:00 51 23 * * *""

after that time, it stopped running cron again.

 

I suspect that  it requires code level modification resolve it.

zz s's profile picture
Posts: 9

04 March 2016, 7:32 PM

I found the log information as:

 


[INF] 07 (lib/cron.php:31) ---------- cron running Fri, 04 Mar 2016 12:14:02 +0800 ----------
[WAR] 07 (lib/adodb/adodb-time.inc.php:1073) mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("mktime(): It is not safe to rely on the system's t...", 8, true, true, "/var/www/html/mahara/lib/adodb/adodb-time.inc.php", 1073) at /var/www/html/mahara/lib/errors.php:441
* error(2, "mktime(): It is not safe to rely on the system's t...", "/var/www/html/mahara/lib/adodb/adodb-time.inc.php", 1073, array(size 6)) at Unknown:0
* mktime(00, 0, 1, 1, 1971) at /var/www/html/mahara/lib/adodb/adodb-time.inc.php:1073
* adodb_date("'Y-m-d H:i:s'", 1457064842) at /var/www/html/mahara/lib/adodb/adodb.inc.php:2546
* ADOConnection->DBTimeStamp(1457064842) at /var/www/html/mahara/lib/adodb/adodb.inc.php:2524
* ADOConnection->BindTimeStamp(1457064842) at /var/www/html/mahara/lib/dml.php:1460
* db_format_timestamp(1457064842) at /var/www/html/mahara/lib/cron.php:47

[WAR] 07 (lib/cron.php:491) date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("date(): It is not safe to rely on the system's tim...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 491) at /var/www/html/mahara/lib/errors.php:441
* error(2, "date(): It is not safe to rely on the system's tim...", "/var/www/html/mahara/lib/cron.php", 491, array(size 7)) at Unknown:0
* date("r", "1456988701") at /var/www/html/mahara/lib/cron.php:491
* cron_lock(object(stdClass), 1457064842) at /var/www/html/mahara/lib/cron.php:119

anonymous profile picture
Deleted user
Posts: 1

04 March 2016, 10:35 PM

Hi,

Exactly the same issue here. We actually upgraded to 15.10.1 only a few days ago and so I'm wondering if it's related to that (prior to this the cron always able ran normally and without issue).

We also had to manually change the relevant cron entry in the config table in order to make the cron run (which it did, temporarily, before failing again).

Log info. is as follows:

 

[INF] 3c (lib/cron.php:31) ---------- cron running Fri, 04 Mar 2016 17:31:01 +0800 ----------
[WAR] 3c (lib/adodb/adodb-time.inc.php:1073) mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("mktime(): It is not safe to rely on the system's t...", 8, true, true, "/var/www/html/mahara/lib/adodb/adodb-time.inc.php", 1073) at /var/www/html/mahara/lib/errors.php:441
* error(2, "mktime(): It is not safe to rely on the system's t...", "/var/www/html/mahara/lib/adodb/adodb-time.inc.php", 1073, array(size 6)) at Unknown:0
* mktime(00, 0, 1, 1, 1971) at /var/www/html/mahara/lib/adodb/adodb-time.inc.php:1073
* adodb_date("'Y-m-d H:i:s'", 1457083861) at /var/www/html/mahara/lib/adodb/adodb.inc.php:2546
* ADOConnection->DBTimeStamp(1457083861) at /var/www/html/mahara/lib/adodb/adodb.inc.php:2524
* ADOConnection->BindTimeStamp(1457083861) at /var/www/html/mahara/lib/dml.php:1460
* db_format_timestamp(1457083861) at /var/www/html/mahara/lib/cron.php:47

[WAR] 3c (lib/cron.php:491) date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("date(): It is not safe to rely on the system's tim...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 491) at /var/www/html/mahara/lib/errors.php:441
* error(2, "date(): It is not safe to rely on the system's tim...", "/var/www/html/mahara/lib/cron.php", 491, array(size 7)) at Unknown:0
* date("r", "1457075701") at /var/www/html/mahara/lib/cron.php:491
* cron_lock(object(stdClass), 1457083861) at /var/www/html/mahara/lib/cron.php:119

[INF] 3c (lib/cron.php:501) Skipping long-running cron job core_cron_site_data_daily (Fri, 04 Mar 2016 15:15:01 +0800).
[WAR] 3c (lib/cron.php:491) date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("date(): It is not safe to rely on the system's tim...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 491) at /var/www/html/mahara/lib/errors.php:441
* error(2, "date(): It is not safe to rely on the system's tim...", "/var/www/html/mahara/lib/cron.php", 491, array(size 7)) at Unknown:0
* date("r", "1457075762") at /var/www/html/mahara/lib/cron.php:491
* cron_lock(object(stdClass), 1457083861) at /var/www/html/mahara/lib/cron.php:119

[INF] 3c (lib/cron.php:501) Skipping long-running cron job core_cron_institution_data_daily (Fri, 04 Mar 2016 15:16:02 +0800).
[INF] 3c (lib/cron.php:137) Running core cron check_imap_for_bounces
[WAR] 3c (lib/cron.php:171) getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("getdate(): It is not safe to rely on the system's ...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 171) at /var/www/html/mahara/lib/errors.php:441
* error(2, "getdate(): It is not safe to rely on the system's ...", "/var/www/html/mahara/lib/cron.php", 171, array(size 2)) at Unknown:0
* getdate(1457083861) at /var/www/html/mahara/lib/cron.php:171
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:310) mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("mktime(): It is not safe to rely on the system's t...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 310) at /var/www/html/mahara/lib/errors.php:441
* error(2, "mktime(): It is not safe to rely on the system's t...", "/var/www/html/mahara/lib/cron.php", 310, array(size 1)) at Unknown:0
* mktime(00, 0, 3, 4, 2016) at /var/www/html/mahara/lib/cron.php:310
* cron_day_of_week(array(size 11)) at /var/www/html/mahara/lib/cron.php:332
* cron_valid_day(array(size 8), array(size 11)) at /var/www/html/mahara/lib/cron.php:188
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:310) date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("date(): It is not safe to rely on the system's tim...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 310) at /var/www/html/mahara/lib/errors.php:441
* error(2, "date(): It is not safe to rely on the system's tim...", "/var/www/html/mahara/lib/cron.php", 310, array(size 1)) at Unknown:0
* date("w", 1457020800) at /var/www/html/mahara/lib/cron.php:310
* cron_day_of_week(array(size 11)) at /var/www/html/mahara/lib/cron.php:332
* cron_valid_day(array(size 8), array(size 11)) at /var/www/html/mahara/lib/cron.php:188
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:220) mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("mktime(): It is not safe to rely on the system's t...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 220) at /var/www/html/mahara/lib/errors.php:441
* error(2, "mktime(): It is not safe to rely on the system's t...", "/var/www/html/mahara/lib/cron.php", 220, array(size 1)) at Unknown:0
* mktime(17, 32, 0, 3, 4, 2016) at /var/www/html/mahara/lib/cron.php:220
* datearray_to_timestamp(array(size 11)) at /var/www/html/mahara/lib/cron.php:208
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[INF] 3c (lib/cron.php:137) Running core cron watchlist_process_notifications
[WAR] 3c (lib/cron.php:171) getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("getdate(): It is not safe to rely on the system's ...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 171) at /var/www/html/mahara/lib/errors.php:441
* error(2, "getdate(): It is not safe to rely on the system's ...", "/var/www/html/mahara/lib/cron.php", 171, array(size 2)) at Unknown:0
* getdate(1457083861) at /var/www/html/mahara/lib/cron.php:171
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:310) mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("mktime(): It is not safe to rely on the system's t...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 310) at /var/www/html/mahara/lib/errors.php:441
* error(2, "mktime(): It is not safe to rely on the system's t...", "/var/www/html/mahara/lib/cron.php", 310, array(size 1)) at Unknown:0
* mktime(00, 0, 3, 4, 2016) at /var/www/html/mahara/lib/cron.php:310
* cron_day_of_week(array(size 11)) at /var/www/html/mahara/lib/cron.php:332
* cron_valid_day(array(size 8), array(size 11)) at /var/www/html/mahara/lib/cron.php:188
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:310) date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("date(): It is not safe to rely on the system's tim...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 310) at /var/www/html/mahara/lib/errors.php:441
* error(2, "date(): It is not safe to rely on the system's tim...", "/var/www/html/mahara/lib/cron.php", 310, array(size 1)) at Unknown:0
* date("w", 1457020800) at /var/www/html/mahara/lib/cron.php:310
* cron_day_of_week(array(size 11)) at /var/www/html/mahara/lib/cron.php:332
* cron_valid_day(array(size 8), array(size 11)) at /var/www/html/mahara/lib/cron.php:188
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:220) mktime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("mktime(): It is not safe to rely on the system's t...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 220) at /var/www/html/mahara/lib/errors.php:441
* error(2, "mktime(): It is not safe to rely on the system's t...", "/var/www/html/mahara/lib/cron.php", 220, array(size 1)) at Unknown:0
* mktime(17, 32, 0, 3, 4, 2016) at /var/www/html/mahara/lib/cron.php:220
* datearray_to_timestamp(array(size 11)) at /var/www/html/mahara/lib/cron.php:208
* cron_next_run_time(1457083861, array(size 8)) at /var/www/html/mahara/lib/cron.php:151

[WAR] 3c (lib/cron.php:168) date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead
Call stack (most recent first):
* log_message("date(): It is not safe to rely on the system's tim...", 8, true, true, "/var/www/html/mahara/lib/cron.php", 168) at /var/www/html/mahara/lib/errors.php:441
* error(2, "date(): It is not safe to rely on the system's tim...", "/var/www/html/mahara/lib/cron.php", 168, array(size 73)) at Unknown:0
* date("r", 1457083861) at /var/www/html/mahara/lib/cron.php:168

[INF] 3c (lib/cron.php:168) ---------- cron finished Fri, 04 Mar 2016 17:31:01 +0800 ----------

 

Ghada El-Zoghbi's profile picture
Posts: 122

31 March 2016, 3:22 PM

Hi,

It looks like you need to set your default timezone in php.ini.

If you don't have access to your php.ini file, you can set it for Mahara in the config.php file:

$cfg->dbtimezone = 'Asia/Chongqing';

Please let me know if this helps.

Cheers,

Ghada

 

05 April 2016, 1:41 AM

I have the same problem after an upgrade to Mahara version 15.10.2 (2015092917)

$ php -f /var/www/html/mahara/files/htdocs/lib/cron.php
[INF] 63 (lib/cron.php:31) ---------- cron running Mon, 04 Apr 2016 15:21:54 +0200 ----------
[INF] 63 (lib/cron.php:501) Skipping long-running cron job core_cron_site_data_daily (Mon, 04 Apr 2016 15:01:50 +0200).
[INF] 63 (lib/cron.php:501) Skipping long-running cron job core_cron_institution_data_daily (Mon, 04 Apr 2016 15:02:02 +0200).
[INF] 63 (lib/cron.php:168) ---------- cron finished Mon, 04 Apr 2016 15:21:54 +0200 ----------

 And in the administrator panel : "Cron is not running."

 

 

I tried to use those sql commands :

SELECT * FROM config WHERE field LIKE '\_%';     

DELETE FROM config WHERE field LIKE '\_%';

But after another "$ php -f /var/www/html/mahara/files/htdocs/lib/cron.php", the problem is the same....

 

In my  /etc/php.ini, I already have : date.timezone = Europe/Paris

 

and in my mahara/config.php I have those lines :

 if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
  @date_default_timezone_set(@date_default_timezone_get());
 }

 

If I add $cfg->dbtimezone = 'Europe/Paris'; in my mahara/config.php, see below :

$ php -f /var/www/html/mahara/files/htdocs/lib/cron.php
[WAR] e1 (init.php:176) Mahara could not connect to the application database.
[WAR] e1 (init.php:176)
[WAR] e1 (init.php:176)  * If you are using Mahara, please wait a minute and try again
[WAR] e1 (init.php:176)  * If you are the administrator, please check your database settings and make sure your database is available
[WAR] e1 (init.php:176)
[WAR] e1 (init.php:176) The error received was:
[WAR] e1 (init.php:176) mysqli error: [1298: Unknown or incorrect time zone: 'Europe/Paris'] in EXECUTE("SET time_zone='Europe/Paris'")
[WAR] e1 (init.php:176)
Call stack (most recent first):
  * require() at /var/www/html/mahara/files/htdocs/lib/cron.php:17

Mahara could not connect to the application database.

 * If you are using Mahara, please wait a minute and try again
 * If you are the administrator, please check your database settings and make sure your database is available

The error received was:
mysqli error: [1298: Unknown or incorrect time zone: 'Europe/Paris'] in EXECUTE("SET time_zone='Europe/Paris'")

 If I cancel the line $cfg->dbtimezone = 'Europe/Paris'; in my mahara/config.php =>

$ php -f /var/www/html/mahara/files/htdocs/lib/cron.php
[INF] 15 (lib/cron.php:31) ---------- cron running Mon, 04 Apr 2016 15:41:41 +0200 ----------
[INF] 15 (lib/cron.php:501) Skipping long-running cron job core_cron_site_data_daily (Mon, 04 Apr 2016 15:40:38 +0200).
[INF] 15 (lib/cron.php:501) Skipping long-running cron job core_cron_institution_data_daily (Mon, 04 Apr 2016 15:41:01 +0200).
[INF] 15 (lib/cron.php:168) ---------- cron finished Mon, 04 Apr 2016 15:41:41 +0200 ----------

 

 

Ghada El-Zoghbi's profile picture
Posts: 122

05 April 2016, 10:06 PM

Hi,

MySQL needs the time zones loaded in its database.

Please refer to this post:
http://stackoverflow.com/questions/5510052/changing-the-connection-timezone-in-mysql/16946123#16946123

Please let me know if this helps.

Cheers,
Ghada

06 April 2016, 1:03 AM

$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Enter password:
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.

mysql> select convert_tz(now(), 'UTC', 'CET');
+---------------------------------+
| convert_tz(now(), 'UTC', 'CET') |
+---------------------------------+
| 2016-04-05 16:43:57             |
+---------------------------------+
1 row in set (0.00 sec)

]$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -p mysql --force 2> /dev/null
Enter password:
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
$

PS/ I tried with sql-mode = STRICT_ALL_TABLES  and then with sql-mode = STRICT_TRANS_TABLES in my.cnf [mysqld]........

 

 

 

06 April 2016, 1:15 AM

It's me again.... I tried to force the datezone but the problem is the same....

mysql> use mysql;
mysql> set time_zone='Europe/Paris';
mysql> select now();
+---------------------+
| now()               |
+---------------------+
| 2016-04-05 15:12:42 |
+---------------------+
1 row in set (0.00 sec)



 

 

35 results