Hello everybody,
I want to use a python script to check if certain ips are still online and if not, i want the system to shut down.
Therefore I have created a list of client ip's and a loop to check every ip if its online or not and then, if all ip's are down, execute a command (in this example it is the command #Command1) and if not, it should execute another command (in this exampe #Command2).
I want to use a python script to check if certain ips are still online and if not, i want the system to shut down.
Therefore I have created a list of client ip's and a loop to check every ip if its online or not and then, if all ip's are down, execute a command (in this example it is the command #Command1) and if not, it should execute another command (in this exampe #Command2).
def ip_check():
hosts = [
"192.168.180.100",
"192.168.180.101",
"192.168.180.102",
"192.168.180.103",
"192.168.180.104",
"192.168.180.105",
"192.168.180.106"
]
for x in hosts:
host_response = os.system("ping -c 1 " + str(hosts))
if guest_response == 0:
#Command1
else:
#Command2The problem is, all i get is this output and I don't know how to fix it:ping: 192.168.180.106]: Name or service not known ping: 192.168.180.106]: Name or service not known ping: 192.168.180.106]: Name or service not known ping: 192.168.180.106]: Name or service not known ping: 192.168.180.106]: Name or service not known ping: 192.168.180.106]: Name or service not known ping: 192.168.180.106]: Name or service not known
