[arch-general] How to reboot remotely without hanging ssh session?

Robert Knauer robert at privatdemail.net
Sun Feb 23 14:09:28 EST 2014


On 05.02.2014 20:19, David C. Rankin wrote:
> Guys,
> 
>   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.

Regards,
Robert.

-- 
GnuPG-Key: EDC67BBA
Fingerprint: D5F0 BC03 3F6D 521C 6F2D  40C8 DDBA 25D9 EDC6 7BBA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 295 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-general/attachments/20140223/9c0b2f60/attachment.asc>


More information about the arch-general mailing list