Commit 0da66479 authored by Mac Newbold's avatar Mac Newbold

Fix for Mike: turning off doesn't count for min. time between reboots.

parent 67a7bceb
......@@ -156,14 +156,19 @@ foreach my $node (@machines) {
#
# Check for rate-limiting, and update the last power cycle time
# if it's been long enough. Root gets to bypass the checks.
# if it's been long enough. Root gets to bypass the checks, and
# we only update the timestamp if it is being turned on or cycled,
# to allow off then on without waiting (unless the on is too close
# to a previos on/cycle command)
#
if (! ($time_ok || ($UID == 0)) ) {
warn "$node was power cycled recently. Skipping...\n";
next;
} else {
DBQueryFatal("update outlets set last_power=CURRENT_TIMESTAMP " .
"where node_id = '$node'");
if ( $op ne "off" ) {
if (! ($time_ok || ($UID == 0)) ) {
warn "$node was power cycled recently. Skipping...\n";
next;
} else {
DBQueryFatal("update outlets set last_power=CURRENT_TIMESTAMP " .
"where node_id = '$node'");
}
}
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment