5

I often use Ubuntu's GNOME Terminal to connect to an external server using ssh. When rebooting the server the Terminal shows this message:

# reboot

Broadcast message from root (pts/0) (Wed Sep 29 13:52:26 2010):

The system is going down for reboot NOW!
# 

And a seconds later the Terminal no longer responds to keystrokes, CTRL-c, CTRL-d, etc... The only escape seems to be closing the Terminal window from the GUI.

Does anyone know of a more elegant way to break out of ssh after a remote server reboot?

11

Type

~. (tilde followed by dot)

and look for 'escape characters' in the man page of ssh.

2

Try using shutdown instead. It allows you to specify a time before the shutdown occurs. Gives you a chance to log out of the session:

sudo /sbin/shutdown -r 60 "System is rebooting in 60 seconds!"
0

Use the "exit" command.

Note:

$ ssh -V

OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009

0

This will schedule the shutdown a moment after (~ 0 seconds) you exit the ssh session.

 sudo shutdown --reboot 0 ; exit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.