diff options
author | Simon Rettberg | 2019-12-07 16:11:12 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-12-07 16:11:12 +0100 |
commit | f5eb7c5c586e36d0c1fb00692c46e8e1dc8f8e9f (patch) | |
tree | 630448e7f994a6d6a447467f746483ca6249f69c | |
parent | [rebootcontrol] Implement assigning subnets to jump host (diff) | |
download | slx-admin-f5eb7c5c586e36d0c1fb00692c46e8e1dc8f8e9f.tar.gz slx-admin-f5eb7c5c586e36d0c1fb00692c46e8e1dc8f8e9f.tar.xz slx-admin-f5eb7c5c586e36d0c1fb00692c46e8e1dc8f8e9f.zip |
[rebootcontrol] cron: Test jumphost availability
-rw-r--r-- | modules-available/rebootcontrol/hooks/cron.inc.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modules-available/rebootcontrol/hooks/cron.inc.php b/modules-available/rebootcontrol/hooks/cron.inc.php index 79a7ec2a..e387e055 100644 --- a/modules-available/rebootcontrol/hooks/cron.inc.php +++ b/modules-available/rebootcontrol/hooks/cron.inc.php @@ -1,6 +1,19 @@ <?php -if (/* mt_rand(1, 2) !== 1 || */ Property::get(RebootControl::KEY_AUTOSCAN_DISABLED)) +/* + * JumpHost availability test, 5 times a day... + */ +if (in_array((int)date('G'), [6, 7, 9, 12, 15]) && in_array(date('i'), ['00', '01', '02', '03'])) { + $res = Database::simpleQuery('SELECT hostid, host, port, username, sshkey, script FROM reboot_jumphost'); + while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + RebootControl::wakeViaJumpHost($row, '255.255.255.255', [['macaddr' => '00:11:22:33:44:55']]); + } +} + +/* + * Client reachability test -- can be disabled + */ +if (mt_rand(1, 2) !== 1 || Property::get(RebootControl::KEY_AUTOSCAN_DISABLED)) return; class Stuff |