I have remote linux server with paid kvm and very slow 'reboot on request' service. Now when I reboot server with 'sudo reboot' ssh disconnects me within 3-5 seconds, but then server sometimes continue running, I guess, waiting for some rc.d script shutting down. Network still configured, so I can even ping server, but ssh connections can't be established, so, apparently, sshd is down. I can't even dig inside to detect, what is going on during shutdown. So, the question is: how to prevent sshd from stopping during system shutdown? I want sshd running until total system poweroff.
Your operating system needs to stop all processes prior to shutting down. That includes killing off your SSH connections.
You can reorder the shutdown scripts so