To shutdown all network computers
To shutdown all network computers
I have a centos 7 server ....Pls anyone can help me to make a shell script to shutdown all network computers (windows and linux) ..I will be grateful....
-
- Posts: 1522
- Joined: 2014/05/21 20:16:00
- Location: Central New York, USA
Re: To shutdown all network computers
It would need to login to each machine and, as root / sudo, perform shutdown -h now, then move on to the next machine as far as I know - that's for the Linux machines.
I doubt there's a way to do it from "outside" - otherwise anyone could do what you're trying to do, ant time they wished.
I doubt there's a way to do it from "outside" - otherwise anyone could do what you're trying to do, ant time they wished.
Re: To shutdown all network computers
Depending on your hardware there's a good chance to accomplish this task with WOL (wake on lan) instead of scripting around ssh.
However, personally I would prefer ansible as an orchestration tool - in my opinion this is a neat solution no matter how large your system pool is. And it comes with tons of other improvement...
However, personally I would prefer ansible as an orchestration tool - in my opinion this is a neat solution no matter how large your system pool is. And it comes with tons of other improvement...
Last edited by fdisk on 2018/09/15 09:33:53, edited 1 time in total.
Re: To shutdown all network computers
I've not used ansible myself (though having a look now), but the freeware xCAT gives you the psh (parallel shell) command. Once configured you can issue commands such as:
or
Assuming you can find a suitable Windows command, you could add that. psh uses ssh to connect and then just passes the rest of the line to whatever shell responds. The commands are issued in parallel, so sometimes the output can be a bit confusing.
Code: Select all
# psh all shutdown -h now
Code: Select all
$ psh linux-servers sudo shutdown -h now