On 10/05/2018 08:49 AM, Roger Oberholtzer wrote:
On a local network, what would be the preferred way for one system to shut down or reboot another system? Something over the network. I am thinking that a systemd service on the master system (openSUSE) would control this other system (Linux - openSUSE or Ubuntu).
ssh? I have played with rexec/rcmd and such before. I do not need anything fancy. But a password (exchanged keys perhaps) is needed.
I just use a couple simple functions in the .bashrc on the remote (requires sudo access setup for the current user, or run as root) The poweroff function is: scpoweroff () { ( sleep 5; sudo systemctl poweroff ) & exit } I later alias it to `scpo`. The reboot function in the remote .bashrc is: screboot () { ( sleep 5; sudo systemctl reboot ) & exit } which I lazily alias to `scrb` Both work fine. By backgrounding the subshell, you exit the ssh session immediately and on the remote host after the 5 second sleep expires, systemctl either powers the remote system off or reboots it. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org