From dc516c24685518b41bcce0751caf286dc65e471f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 17 Mar 2021 15:39:55 +0100 Subject: [locations/rebootcontrol] Change ENUM constants; display next event --- modules-available/rebootcontrol/hooks/cron.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules-available/rebootcontrol/hooks/cron.inc.php') diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php index 56446c49..c1136c98 100644 --- a/modules-available/rebootcontrol/hooks/cron.inc.php +++ b/modules-available/rebootcontrol/hooks/cron.inc.php @@ -27,12 +27,14 @@ while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $machines = Database::queryAll("SELECT machineuuid, clientip, macaddr, locationid FROM machine WHERE locationid = :locid", ['locid' => $row['locationid']]); - if ($row['action'] === 'sd') { + if ($row['action'] === Scheduler::SHUTDOWN) { RebootControl::execute($machines, RebootControl::SHUTDOWN, 0); - } elseif ($row['action'] === 'wol') { + } elseif ($row['action'] === Scheduler::WOL) { RebootControl::wakeMachines($machines); - } elseif ($row['action'] === 'rb') { + } elseif ($row['action'] === Scheduler::REBOOT) { RebootControl::execute($machines, RebootControl::REBOOT, 0); + } else { + EventLog::warning("Invalid action '{$row['action']}' in schedule for location " . $row['locationid']); } } -- cgit v1.2.3-55-g7522