Script that turns off a list of servers in network
Hi all,
Can anyone help me write a script(cron Job) that will automatically turn off a list of servers that are connected over a lan.Is there any way I can do this or anywhere I can find this one. Thanks, Ajit |
you can use nmap
Code:
nmap -sP -PI -PT 10.0.0.0/24 |
what do you mean by "turn off". do you want to do a remote shutdown ?
|
Quote:
Ajit |
Quote:
Ajit |
you don't do remote shutdown using nmap.
|
Quote:
Ajit |
Quote:
You have been suggested how to discover servers on your local network using 'nmap'. Then knowing the IP addresses, you can shut down the servers using the commands that are supposed to perform the shutdown and supplying the commands with IP addresses discovered by 'nmap'. Probably shutdown can be done through 'ssh' login to the server to be shut down, and then calling 'poweroff', but most likely you have to eventually become root on the server. |
I got U.
With nmap I can find the ip of the different servers. Thanks for that additional information.Here in my case I know the ip addresses of the servers but how do I proceed from here. I will tell you my requirement in short I have to run a script actually that too should run automatically at some predefined time which does the following logins into the servers. Later can su as root and than run the shutdown command which will shutdown all the servers within that script. Thanks Ajit |
install a ssh key for an admin account on each of the servers you want shutdown, then call shutdown -whatever whenever from your script.
|
ok.Still I am not able to to whatever is required.Can someone help me out with the script.
Ajit |
Quote:
Or you want us to write a script for you ? |
http://www.freeos.com/guides/lsst/ <-- Great BASH tutorial.
|
I dont want you to write a script for me but if you people can help me out that will be great.
The script that I have written is as below spawn telnet 135.27.153.243 shutdown -t 180 135.27.153.201 And the error that I get when I run the script is invalid command name "shutdown" while executing "shutdown -t 180 135.27.153.201" (file "./shut_down" line 3) Ajit |
Quote:
Based on which manual pages did you choose your commands and arguments ? Specifically, can you show me the lines in 'man shutdown' which mention IP address ? Did you perform successful remote shutdown manually ? If yes, what did you exactly do ? If not, why do you start with a script in the first place ? The last, but not least: do you first read man pages or do you first bother other people ? |
All times are GMT -5. The time now is 10:45 AM. |