[opensuse] Remote system shutdown
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. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/05/2018 09: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.
Ssh works fine. Just log in su to root and give the command. It's also possible to script it so that you only have to click on an icon or give a single command. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Op vrijdag 5 oktober 2018 15:49:12 CEST schreef Roger Oberholtzer:
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. One word: Saltstack It might have some internal command but this works for me: # salt 'MINION_NAME' cmd.run 'shutdown -h now' And of course this could be built in a cronjob, a systemd timer, or some salt state.
-- Gertjan Lettink a.k.a. Knurpht openSUSE Board Member openSUSE Forums Team -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
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.
ssh target 'shutdown' or 'reboot' ? -- Per Jessen, Zürich (19.8°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Fri, Oct 5, 2018 at 4:19 PM Per Jessen <per@computer.org> wrote:
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.
ssh target 'shutdown' or 'reboot' ?
That's what I would think. I am just curious if I am missing some detail. I think this will be in a systemd service that mimics whatever the user is doing locally. A local reboot does a remote boot. A local shutdown does a remote shutdown. Or something like that. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/05/2018 10:29 AM, Roger Oberholtzer wrote:
I think this will be in a systemd service that mimics whatever the user is doing locally. A local reboot does a remote boot. A local shutdown does a remote shutdown.
Don't forget, those commands are for root, not mere mortals. So, you'll have to be root when issuing the command or use sudo. It's been quite a while since I've done this sort of thing, but I have created remote commands using ssh. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Roger Oberholtzer wrote:
On Fri, Oct 5, 2018 at 4:19 PM Per Jessen <per@computer.org> wrote:
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.
ssh target 'shutdown' or 'reboot' ?
That's what I would think. I am just curious if I am missing some detail.
I do the above frequently - for remote systems, for local.
I think this will be in a systemd service that mimics whatever the user is doing locally. A local reboot does a remote boot. A local shutdown does a remote shutdown.
Or something like that.
I guess you have additional requirements - a master-slave setup? -- Per Jessen, Zürich (18.9°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/10/2018 16.29, Roger Oberholtzer wrote:
On Fri, Oct 5, 2018 at 4:19 PM Per Jessen <per@computer.org> wrote:
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.
ssh target 'shutdown' or 'reboot' ?
That's what I would think. I am just curious if I am missing some detail.
I think this will be in a systemd service that mimics whatever the user is doing locally. A local reboot does a remote boot. A local shutdown does a remote shutdown.
Or something like that.
You just run "poweroff" as root in the ssh session as root (or user, then su). However, if there is a graphical session in that computer, with someone there, his session will die suddenly, no data saved at all. Same if there are remote users. I remember that some commands give a message to everybody that poweroff is coming in 5 minutes. But I do not see it in "man halt" or "man poweroff". Maybe "shutdown". shutdown [OPTIONS...] [TIME] [WALL...] I'm unsure of "systemctl" command to do the same and properly. Maybe switch to level 0. But I do not trust it, in my machine switch to level 3 hangs. -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.0 (Legolas))
On 5 Oct 2018, at 19:56, Carlos E. R. <robin.listas@telefonica.net>
However, if there is a graphical session in that computer, with someone there, his session will die suddenly, no data saved at all. Same if there are remote users.
I remember that some commands give a message to everybody that poweroff is coming in 5 minutes. But I do not see it in "man halt" or "man poweroff".
Maybe "shutdown".
shutdown [OPTIONS...] [TIME] [WALL...]
I'm unsure of "systemctl" command to do the same and properly. Maybe switch to level 0. But I do not trust it, in my machine switch to level 3 hang
The remote system runs services that the master needs. No one is logged in. When the master goes away the services are no longer needed. We used to do diskless stuff with no changes to the image. Then it could just be powered off. But sometimes that setup is not feasible. I would like a similar solution for shutting down a Windows system. We are sometimes forced to add one to the mix. Sigh. — Roger -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 2018-10-05 02:03 PM, Roger Oberholtzer wrote:
The remote system runs services that the master needs. No one is logged in. When the master goes away the services are no longer needed. We used to do diskless stuff with no changes to the image. Then it could just be powered off. But sometimes that setup is not feasible. I would like a similar solution for shutting down a Windows system. We are sometimes forced to add one to the mix. Sigh.
See Knurpht's post. Saltstack (which I know nothing about, other than what I just looked up on the web) is python-based, so will run on anything that can run python. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
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
Roger Oberholtzer wrote:
ssh? I have played with rexec/rcmd and such before. I do not need anything fancy. But a password (exchanged keys perhaps) is needed.
That's what we use here for all our slave copmuters (running camera daemons for data acquisition etc.): ssh -f -o ConnectTimeout=1 root@<target> poweroff You'll need the proper keys installed in authorized_keys on the slave (unless you want to type the password permanently), but probably that is in place already anyhow? For powerup we use ether-wake. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Peter Suetterlin wrote:
Roger Oberholtzer wrote:
ssh? I have played with rexec/rcmd and such before. I do not need anything fancy. But a password (exchanged keys perhaps) is needed.
That's what we use here for all our slave copmuters (running camera daemons for data acquisition etc.):
ssh -f -o ConnectTimeout=1 root@<target> poweroff
You'll need the proper keys installed in authorized_keys on the slave (unless you want to type the password permanently), but probably that is in place already anyhow?
For powerup we use ether-wake.
I was also going to suggest using IPMI, but I wasn't sure if Roger had that option. -- Per Jessen, Zürich (14.9°C) http://www.dns24.ch/ - your free DNS host, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, Oct 9, 2018 at 8:34 AM Per Jessen <per@computer.org> wrote:
I was also going to suggest using IPMI, but I wasn't sure if Roger had that option.
As in :) IPMI: The most dangerous protocol you've never heard of The machines are usually intel, which I guess is a requirement. But there is no rule that it must be that way. I will have a look see. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Roger Oberholtzer wrote:
On Tue, Oct 9, 2018 at 8:34 AM Per Jessen <per@computer.org> wrote:
I was also going to suggest using IPMI, but I wasn't sure if Roger had that option.
As in :)
IPMI: The most dangerous protocol you've never heard of
Depending on your setup, keep it on a separate VLAN. We use it to let customers have serial conosle and power-on/off control of their leased machines, as well as for STONITH in two high-availability clusters. -- Per Jessen, Zürich (14.8°C) http://www.cloudsuisse.com/ - your owncloud, hosted in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (8)
-
Carlos E. R.
-
Darryl Gregorash
-
David C. Rankin
-
James Knott
-
Knurpht-openSUSE
-
Per Jessen
-
Peter Suetterlin
-
Roger Oberholtzer