[arch-general] How to reboot remotely without hanging ssh session?
robert at privatdemail.net
Sun Feb 23 14:09:28 EST 2014
On 05.02.2014 20:19, David C. Rankin wrote:
> I remote administer one arch server and after moving to systemd I
> haven't found a way to reboot without hanging the ssh session. Prior to
> system, we could simply pass the shutdown command via ssh and the ssh
> session would complete/close before reboot took place: i.e.
> $ ssh remote.host.org "sudo shutdown -r now"
> However with systemd, using "systemctl reboot" the ssh session hangs
> until the remote host reboot or a timeout occurs.
> Is there a better way to reboot a remote server and avoid this?
I'm using the following line:
$ su -c "systemctl --no-block reboot" && exit
I enter my password, then I instantly see the broadcast message telling
me that the system is going down and the ssh session gets closed.
If you started the session as root, this line should do:
# systemctl --no-block reboot && exit
I didn't try it, because root login is disabled on my machines.
Fingerprint: D5F0 BC03 3F6D 521C 6F2D 40C8 DDBA 25D9 EDC6 7BBA
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 295 bytes
Desc: OpenPGP digital signature
More information about the arch-general