summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-17 11:56:43 +0200
committerSimon Rettberg2017-05-17 11:56:43 +0200
commitfaae75ed40d608d3fd734d5ffc2d786107c367a9 (patch)
treee8d58e9beff1b339587d6f26656cf4542c109f40
parent[apis/cron] Fix typo in 'EventLog' handle blocked jobs in separate list (diff)
downloadslx-admin-faae75ed40d608d3fd734d5ffc2d786107c367a9.tar.gz
slx-admin-faae75ed40d608d3fd734d5ffc2d786107c367a9.tar.xz
slx-admin-faae75ed40d608d3fd734d5ffc2d786107c367a9.zip
cron: Clear stucklist on reboot
-rw-r--r--apis/cron.inc.php2
-rw-r--r--inc/event.inc.php4
-rw-r--r--inc/property.inc.php11
3 files changed, 16 insertions, 1 deletions
diff --git a/apis/cron.inc.php b/apis/cron.inc.php
index b727b21f..7431e9ef 100644
--- a/apis/cron.inc.php
+++ b/apis/cron.inc.php
@@ -17,7 +17,7 @@ define('CRON_KEY_BLOCKED', 'cron.key.blocked');
if (($report = Request::get('crashreport', false, 'string'))) {
$list = Property::getList(CRON_KEY_STATUS);
if (empty($list)) {
- error_log('Cron crashreport triggered but no cronjob marked active.');
+ error_log('Cron crash report triggered but no cronjob marked active.');
exit(0);
}
$str = array();
diff --git a/inc/event.inc.php b/inc/event.inc.php
index 7a7c48b0..89e68650 100644
--- a/inc/event.inc.php
+++ b/inc/event.inc.php
@@ -20,6 +20,10 @@ class Event
EventLog::info('System boot...');
$everythingFine = true;
+ // Delete job entries that might have been running when system rebooted
+ Property::clearList('cron.key.status');
+ Property::clearList('cron.key.blocked');
+
// Tasks: fire away
$mountId = Trigger::mount();
$autoIp = Trigger::autoUpdateServerIp();
diff --git a/inc/property.inc.php b/inc/property.inc.php
index b33e1bff..0b4ea7b3 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -105,6 +105,17 @@ class Property
));
}
+ /**
+ * Delete entire list with given key.
+ *
+ * @param string $key Key of list
+ * @return int number of items removed
+ */
+ public static function clearList($key)
+ {
+ return Database::exec("DELETE FROM property_list WHERE name = :key", compact('key'));
+ }
+
/*
* Legacy getters/setters
*/