I basically want to have a windows batch script which goes through a list of servers and checks every server with a ping if it is online.
The list of servers should be a simple plain text file and should look something like this:
...
"Google" www.google.com
"Node1" 221.12.123.1
"Download Server" dl.myserver.com
"Login Server" login.myserver.com
...
Here is a simple rundown what the program should do:
- print a list of the descriptions of all the servers in the list to the screen.
- ping the first server server 4 times if one ping succeeds it should return online if all 4 pings fail it should return offline.
- print online or offline next to the first server in the printed list
- run step 2 and 3 for all other servers in the list.
The output should look like the following:
...
Google: online
Stackoverflow: online
Node1: online
Download Server: offline
Login server: offline
...
I just want to know if this is even possible in (windows) batch and how to do it. If it isn't possible in batch, what programming language should I use? Would it be possible to program this in Python?
I would also be really thankful if anybody could post the code how to do this, Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…