I am using the reboot -f command remotely to force reboot a Unix machine. The problem is that the connection remains active for a long time which i don't know why? I want to close the ssh connection immediately after rebooting the machine and return to my own shell. How can i do that? Note that the reboot command without -f doesnot work!
The command
Since the SSH server process is dead, the SSH client won't die until the timer fires up. If you run
However, this is not reliable: depending on timing, step 3 might happen before step 2. Adding a timer makes this unlikely:
To be absolutely sure that the server side is committed to running |
|||||
|
How about exit from ssh session and reboot system using next command:
After this just press Ctrl+C for terminate ssh. |
|||
|
Have you tried the following
I find that on some systems I worked on in the pass, the reboot command had some problems. Then again I can't find anything in the manpage of shutdown that would do the same as reboot with the -f flag. |
|||||
|
I found a solution for this which might be helpful for others as well. I used the following command to close the connection right after starting the command attached to ssh:
I dont exactly understand the reason why this command forces the connection to close done but at least it was helpful for me. If anyone understands the directing of the output of the command to /dev/null and why it kills the ssh connection it would be nice if he/she can explain i |
|||
|