From aceb4d7e187a571019e4bc24cd23efc7c2f624fe Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Wed, 4 Dec 2019 18:09:57 +0200 Subject: shutdown: T1826: Modify cancel reboot msg --- src/op_mode/powerctrl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/op_mode/powerctrl.py') 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 -- cgit v1.2.3