summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/hooks/cron.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2021-03-17 15:39:55 +0100
committerSimon Rettberg2021-03-17 15:39:55 +0100
commitdc516c24685518b41bcce0751caf286dc65e471f (patch)
treec4db8569fe044752f9cf4ba58c8c5ad986a27b55 /modules-available/rebootcontrol/hooks/cron.inc.php
parentAdd missing changes (diff)
downloadslx-admin-dc516c24685518b41bcce0751caf286dc65e471f.tar.gz
slx-admin-dc516c24685518b41bcce0751caf286dc65e471f.tar.xz
slx-admin-dc516c24685518b41bcce0751caf286dc65e471f.zip
[locations/rebootcontrol] Change ENUM constants; display next event
Diffstat (limited to 'modules-available/rebootcontrol/hooks/cron.inc.php')
-rw-r--r--modules-available/rebootcontrol/hooks/cron.inc.php8
1 files changed, 5 insertions, 3 deletions
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']);
}
}