summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/rebootcontrol/hooks/cron.inc.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php
index 289426c7..287f58bc 100644
--- a/modules-available/rebootcontrol/hooks/cron.inc.php
+++ b/modules-available/rebootcontrol/hooks/cron.inc.php
@@ -179,13 +179,19 @@ foreach ($res as $row) {
}
unset($res);
-$task = Taskmanager::submit('DummyTask', []);
-$task = Taskmanager::waitComplete($task, 4000);
-if (!Taskmanager::isFinished($task)) {
- cron_log('Task manager down. Doing nothing.');
- return; // No :-(
+function checkTmUp()
+{
+ static $done = false;
+ if ($done)
+ return;
+ $done = true;
+ $task = Taskmanager::submit('DummyTask', []);
+ $task = Taskmanager::waitComplete($task, 4000);
+ if (!Taskmanager::isFinished($task)) {
+ cron_log('TaskManager down. Doing nothing.');
+ exit; // No :-(
+ }
}
-unset($task);
/*
* Try server to client
@@ -194,8 +200,10 @@ unset($task);
$res = Database::simpleQuery("SELECT subnetid FROM reboot_subnet
WHERE subnetid IN (:active) AND nextdirectcheck < UNIX_TIMESTAMP() AND fixed = 0
ORDER BY nextdirectcheck ASC LIMIT 10", ['active' => array_keys(Stuff::$subnets)]);
+
cron_log('Direct checks: ' . $res->rowCount() . ' (' . implode(', ', array_keys(Stuff::$subnets)) . ')');
foreach ($res as $row) {
+ checkTmUp();
$dst = (int)$row['subnetid'];
cron_log('Direct check for subnetid ' . $dst);
$result = testServerToClient($dst);
@@ -241,6 +249,7 @@ if (count($combos) > 0) {
LIMIT 10", ['combos' => $combos]);
cron_log('C2C checks: ' . $res->rowCount());
foreach ($res as $row) {
+ checkTmUp();
$src = (int)$row['srcid'];
$dst = (int)$row['dstid'];
$result = testClientToClient($src, $dst);