remote shutdown over ssh
Added by David Koski about 1 year ago
I have installed NUT UPS management software on a VM host (XenServer) to shut down the VMs and need to shut down the storage server from a script after the VMs are shut down. The nmc command "setup appliance poweroff" requires interaction. I do not want to use the NUT client because I want the timing of the shutdown to be right after the VMs are down. How can I do a remote shutdown of Nexenta from a script?
Regards, David Koski dkoski@sutinen.com
Replies
RE: remote shutdown over ssh - Added by Ryan W about 1 year ago
setup appliance poweroff -y should do the trick.
if not that
option expert_mode=1
!shutdown -r now
RE: remote shutdown over ssh - Added by David Koski about 1 year ago
Than you. The trick is to do it from ssh without interaction. I tested:
setup appliance poweroff -y
..and indeed it works. But the shell does not accept ssh commands as far as I can tell.
Regards, David Koski dkoski@sutinen.com
RE: remote shutdown over ssh - Added by Ryan W about 1 year ago
ssh root@host 'shutdown -r now'
to do this automatic you'll either have to pass the password via command line or generate a key and chuck it in /root/.ssh/authorized_keys on the nexenta machine.
ssh root@10.0.0.12 'ls -l' Password: total 450 drwxr-xr-x 3 root root 3 Dec 8 13:15 labcore -rwxr-xr-x 1 root root 432304 Sep 12 13:33 lsiutilSOL.i386 -rw-r--r-- 1 root root 2617 Nov 29 12:32 nexenta-install.log -rw-r--r-- 1 root root 31 Dec 2 21:30 phylog.txt -rw-r--r-- 1 root root 179284 Dec 6 16:00 slotmap.jpg
RE: remote shutdown over ssh - Added by David Koski about 1 year ago
I should have tried it. I assumed it would run the nmc shell. Thanks!
RE: remote shutdown over ssh - Added by Dan Scudder about 1 year ago
Is there a way to send this command from a windows client/VM?