summaryrefslogtreecommitdiff
path: root/src/op_mode/powerctrl.py
diff options
context:
space:
mode:
authorViacheslav Hletenko <seversss265@gmail.com>2019-12-04 18:09:57 +0200
committerChristian Poessinger <christian@poessinger.com>2019-12-04 17:09:57 +0100
commitaceb4d7e187a571019e4bc24cd23efc7c2f624fe (patch)
tree2ec67d1d317f77268206675915feb03f5b9dbf10 /src/op_mode/powerctrl.py
parent3ea9bcedd56b898005ce9c69148347a73f0d5d7e (diff)
downloadvyos-1x-aceb4d7e187a571019e4bc24cd23efc7c2f624fe.tar.gz
vyos-1x-aceb4d7e187a571019e4bc24cd23efc7c2f624fe.zip
shutdown: T1826: Modify cancel reboot msg
Diffstat (limited to 'src/op_mode/powerctrl.py')
-rwxr-xr-xsrc/op_mode/powerctrl.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py
index e3644e063..46ebf5ffb 100755
--- a/src/op_mode/powerctrl.py
+++ b/src/op_mode/powerctrl.py
@@ -60,7 +60,11 @@ def check_shutdown():
def cancel_shutdown():
try:
- cmd = check_output(["/sbin/shutdown","-c"])
+ timenow = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+ cmd = check_output(["/sbin/shutdown","-c","--no-wall"])
+ message = "Reboot scheduled has been cancelled %s" % timenow
+ #Generate broadcast message about cancel reboot
+ os.system("wall %s" % message)
except CalledProcessError as e:
sys.exit("Error aborting shutdown: %s" % e)
@@ -105,7 +109,7 @@ def execute_shutdown(time, reboot = True, ask=True):
else:
sys.exit("Could not decode time and date")
- print(cmd.decode().split(",",1)[0])
+ check_shutdown()
def chk_vyatta_based_reboots():
### T870 commit-confirm is still using the vyatta code base, once gone, the code below can be removed