To shutdown all network computers

Issues related to configuring your network
Post Reply
Posts: 25
Joined: 2018/05/07 14:05:24

To shutdown all network computers

Post by nike » 2018/09/14 08:41:22

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: 914
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: To shutdown all network computers

Post by lightman47 » 2018/09/14 13:00:58

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.
The more I learn the 'behinder' I get.

User avatar
Posts: 42
Joined: 2017/11/04 00:59:56

Re: To shutdown all network computers

Post by fdisk » 2018/09/14 21:16:05

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...
Last edited by fdisk on 2018/09/15 09:33:53, edited 1 time in total.

Posts: 437
Joined: 2015/05/11 07:53:27
Location: UK

Re: To shutdown all network computers

Post by MartinR » 2018/09/14 23:00:28

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:

Code: Select all

# psh all shutdown -h now

Code: Select all

$ psh linux-servers sudo shutdown -h now
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.

Post Reply