summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-26 13:48:34 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-26 13:49:39 +0200
commitc1e3de49463c7aea8e5f6dbbe6c72aa59d58362f (patch)
tree356d960a629a61627c505a325fcc2171f5109e99 /src
parentd6384b2014c5877cb1cc7e24b1ab2c8562c5f126 (diff)
downloadvyos-1x-c1e3de49463c7aea8e5f6dbbe6c72aa59d58362f.tar.gz
vyos-1x-c1e3de49463c7aea8e5f6dbbe6c72aa59d58362f.zip
powerctl: T2010: fix "wall" complaining about inapproriate ioctl
wall: cannot get tty name: Inappropriate ioctl for device - script is run in the background where there is normally no tty available - silently discard this warning.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/powerctrl.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py
index d33f8633d..b2fb5fe5a 100755
--- a/src/op_mode/powerctrl.py
+++ b/src/op_mode/powerctrl.py
@@ -86,12 +86,12 @@ def cancel_shutdown():
if output and 'MODE' in output:
timenow = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
try:
- cmd('/sbin/shutdown -c --no-wall')
+ run('/sbin/shutdown -c --no-wall')
except OSError as e:
exit("Could not cancel a reboot or poweroff: %s" % e)
- message = "Scheduled %s has been cancelled %s" % (
- output['MODE'], timenow)
- run(f'wall {message}')
+
+ message = 'Scheduled {} has been cancelled {}'.format(output['MODE'], timenow)
+ run(f'wall {message} > /dev/null 2>&1')
else:
print("Reboot or poweroff is not scheduled")