If the server is rebooted, all the processes that were running there are killed. You won't be able to reconnect to them, they're gone. period. All you can do is open a new session to the server and run new processes.
If an SSH session gets stuck, you can press Enter ~ . to disconnect it, you don't need to close the terminal.
You can use autossh to automatically reconnect to the server if the connection drops. Once again, if the connection drops because the server rebooted, you'll get a new shell, your old processes are gone.
If you see sessions getting stuck, then autossh won't reconnect automatically, because a stuck session means that the client machine hasn't noticed that the server is gone. If the server had closed the session properly, you wouldn't get a stuck session, you'd get a message like “Connection to darkstar.example.com closed”. You can set ServerAliveInterval
to a small value to detect abrupt server disconnection faster, at the expense of a higher risk that the connection will be closed due to a temporary network glitch even though the server is still alive.
~.
- that should cause your ssh client to drop the connection.