[arch-general] remote poweroff with systemd

Fons Adriaensen fons at linuxaudio.org
Mon Aug 5 14:39:22 EDT 2013


Hello all,

In one installation I manage I have a script that (among other
actions) remotely shuts down a number of headless machines. 

Until recently these machines used the traditional init scripts,
and the commands in the script were

ssh -t remote1 "sudo /sbin/init 0"
ssh -t remote2 "sudo /sbin/init 0"

etc. This has worked well for years.

Recently the machines were upgraded and mow use systemd.
I replaced the original commands by

ssh -t remote1 "sudo telinit 0"

etc. This shuts down the first one OK, but then the script
hangs. Apparently the ssh connection isn't closed cleanly.

I didn't yet try 'systemctl poweroff', but according the
man page, 'telinit 0' is equivalent to it.

Another one I didn't yet try (just discovered it in the man
pages but I don't have access to the installation ATM) is
systemctl's --host option, in other words, let systemctl
do the ssh. Can this be expected to work ? If not, any
other ideas ?

TIA for any help or hints.


-- 
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)



More information about the arch-general mailing list