summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-11 00:45:55 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-11 14:55:15 +0100
commitc46c19e918edf9304fa65b678e54cb84aca245fc (patch)
treeca03388c4451e47b49cc638f2f096abdf7001a70 /src/op_mode
parentc27f13ab459ef5116eeac417d256abfabf2690c2 (diff)
downloadvyos-1x-c46c19e918edf9304fa65b678e54cb84aca245fc.tar.gz
vyos-1x-c46c19e918edf9304fa65b678e54cb84aca245fc.zip
util: T2226: send shutdown stdout back to the program
The previous code conversion did not match the previous code.
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/powerctrl.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py
index 0f3619411..4ab91384b 100755
--- a/src/op_mode/powerctrl.py
+++ b/src/op_mode/powerctrl.py
@@ -24,6 +24,7 @@ from vyos.util import ask_yes_no
from vyos.util import cmd
from vyos.util import call
from vyos.util import run
+from vyos.util import STDOUT
systemd_sched_file = "/run/systemd/shutdown/scheduled"
@@ -97,14 +98,14 @@ def execute_shutdown(time, reboot = True, ask=True):
chk_vyatta_based_reboots()
###
- out = cmd(f'/sbin/shutdown {action} now')
+ out = cmd(f'/sbin/shutdown {action} now', stderr=STDOUT)
print(out.split(",",1)[0])
return
elif len(time) == 1:
# Assume the argument is just time
ts = parse_time(time[0])
if ts:
- cmd(f'/sbin/shutdown {action} {time[0]}')
+ cmd(f'/sbin/shutdown {action} {time[0]}', stderr=STDOUT)
else:
sys.exit("Invalid time \"{0}\". The valid format is HH:MM".format(time[0]))
elif len(time) == 2:
@@ -115,7 +116,7 @@ def execute_shutdown(time, reboot = True, ask=True):
t = datetime.combine(ds, ts)
td = t - datetime.now()
t2 = 1 + int(td.total_seconds())//60 # Get total minutes
- cmd('/sbin/shutdown {action} {t2}')
+ cmd('/sbin/shutdown {action} {t2}', stderr=STDOUT)
else:
if not ts:
sys.exit("Invalid time \"{0}\". The valid format is HH:MM".format(time[0]))