summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-01-01 11:54:22 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-02-24 21:50:07 +0000
commite7268a72e4589afc732f1927317b7108727d4f60 (patch)
tree3734b331a3ba3d3c9f832e562989ec2236ec9a53
parent03134a19ceac22206e0b6e9a058e378867797534 (diff)
downloadvyatta-op-e7268a72e4589afc732f1927317b7108727d4f60.tar.gz
vyatta-op-e7268a72e4589afc732f1927317b7108727d4f60.zip
vyatta-op: on shutdown/reboot the client ssh session doesn't disconnect
When either the reboot or poweroff commands are issued from the CLI, any ssh clients currently connected to the system aren't disconnected correctly, having to rely on a timeout to terminate them. The sendsigs process doesn't fully close sshd before the network is taken down, with the result that the client don't receive the disconnect signal. Bug #298 http://bugzilla.vyos.net/show_bug.cgi?id=298
-rwxr-xr-xscripts/vyatta-reboot.pl4
-rw-r--r--templates/poweroff/node.def4
-rw-r--r--templates/poweroff/now/node.def2
3 files changed, 6 insertions, 4 deletions
diff --git a/scripts/vyatta-reboot.pl b/scripts/vyatta-reboot.pl
index 3dc212c..bec4ebd 100755
--- a/scripts/vyatta-reboot.pl
+++ b/scripts/vyatta-reboot.pl
@@ -67,7 +67,9 @@ sub do_reboot {
my $login = shift;
syslog("warning", "Reboot now requested by $login");
- exec("sudo /sbin/reboot");
+ if (!system("sudo /sbin/reboot")) {
+ exec("sudo /usr/bin/killall sshd");
+ }
}
sub cancel_reboot {
diff --git a/templates/poweroff/node.def b/templates/poweroff/node.def
index b3a41f1..44b8301 100644
--- a/templates/poweroff/node.def
+++ b/templates/poweroff/node.def
@@ -1,9 +1,9 @@
help: Poweroff the system
run: if [ "$VYATTA_PROCESS_CLIENT" == "gui2_rest" ]
then
- sudo /sbin/shutdown -h now
+ 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 /sbin/shutdown -h now && sudo /usr/bin/killall sshd
fi
diff --git a/templates/poweroff/now/node.def b/templates/poweroff/now/node.def
index 1117668..d9902cb 100644
--- a/templates/poweroff/now/node.def
+++ b/templates/poweroff/now/node.def
@@ -1,3 +1,3 @@
help: Poweroff the system now [disruptive]
-run: sudo /sbin/shutdown -h now
+run: sudo /sbin/shutdown -h now && sudo /usr/bin/killall sshd