summaryrefslogtreecommitdiff
path: root/templates/poweroff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-01-24 15:01:33 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-01-24 20:23:12 +0000
commit119a0b0d12dea51d1a5032552dbe8944308276ca (patch)
tree9952bc3cbafb22efd03656c14e95db3dd9d4fd93 /templates/poweroff
parentf4485f4c2beac42a1cdbde35f900440416e1c5ae (diff)
downloadvyatta-op-119a0b0d12dea51d1a5032552dbe8944308276ca.tar.gz
vyatta-op-119a0b0d12dea51d1a5032552dbe8944308276ca.zip
vyatta-op: update the system poweroff cli command to be script based
Update the system poweroff command to use the vyatta-poweroff.pl script rather than simply uisng the shutdown command. This allows other actions to be taken on shutdown, including correctly disconnecting SSH clients rather than having them resorting to timing out (Bug #298) Bug #460 http://bugzilla.vyos.net/show_bug.cgi?id=460
Diffstat (limited to 'templates/poweroff')
-rw-r--r--templates/poweroff/at/node.tag/node.def7
-rw-r--r--templates/poweroff/cancel/node.def2
-rw-r--r--templates/poweroff/node.def9
-rw-r--r--templates/poweroff/now/node.def5
4 files changed, 6 insertions, 17 deletions
diff --git a/templates/poweroff/at/node.tag/node.def b/templates/poweroff/at/node.tag/node.def
index ccc3b5b..932e04b 100644
--- a/templates/poweroff/at/node.tag/node.def
+++ b/templates/poweroff/at/node.tag/node.def
@@ -1,6 +1,3 @@
help: Poweroff the system at a future time
-allowed: echo -n '<HH:MM>' '<MMDDYY>' '+MM'
-run: if /opt/vyatta/bin/vyatta-gettime.pl $3 >/tmp/shutdown.at
- then (sudo /sbin/shutdown -h $3 &
- disown %?sudo ) >/dev/null 2>&1
- fi
+allowed: echo -n '<HH:MM>' '<MMDDYY>' '<midnight>' '<noon>'
+run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff_at --at_time "$3"
diff --git a/templates/poweroff/cancel/node.def b/templates/poweroff/cancel/node.def
index c08a72d..c45f17a 100644
--- a/templates/poweroff/cancel/node.def
+++ b/templates/poweroff/cancel/node.def
@@ -1,2 +1,2 @@
help: Cancel a pending poweroff
-run: sudo /sbin/shutdown -c
+run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff_cancel
diff --git a/templates/poweroff/node.def b/templates/poweroff/node.def
index 44b8301..ccb7338 100644
--- a/templates/poweroff/node.def
+++ b/templates/poweroff/node.def
@@ -1,9 +1,2 @@
help: Poweroff the system
-run: if [ "$VYATTA_PROCESS_CLIENT" == "gui2_rest" ]
- then
- sudo /sbin/shutdown -h now && sudo /usr/bin/killall sshd
- else
- ${vyatta_bindir}/yesno -n "Proceed with poweroff? (Yes/No) [No] " \
- && sudo /sbin/shutdown -h now && sudo /usr/bin/killall sshd
- fi
-
+run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff
diff --git a/templates/poweroff/now/node.def b/templates/poweroff/now/node.def
index d9902cb..6b67572 100644
--- a/templates/poweroff/now/node.def
+++ b/templates/poweroff/now/node.def
@@ -1,3 +1,2 @@
-help: Poweroff the system now [disruptive]
-run: sudo /sbin/shutdown -h now && sudo /usr/bin/killall sshd
-
+help: Poweroff the system without confirmation
+run: sudo /opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff --now