Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #coding: utf8
- import os
- hostname = "192.168.12.167" #host 1.3
- response = os.system("ping -c 1 " + hostname)
- #and then check the response...
- if response == 0:
- hostname = "192.168.210.10" # host 1.1
- response = os.system("ping -c 1 " + hostname)
- # print (ho, 'is down!')
- if response != 0:
- # print (hostname, 'is down!')
- hostname = "192.168.100.2" # host 1.2
- response = os.system("ping -c 1 " + hostname)
- if response != 0:
- print (hostname, 'is down!')
- # выполняем код 1.3
- else:
- # проверя
- hostname = "192.168.100.3"
- response = os.system("ping -c 1 " + hostname)
- if response == 0:
- hostname = "192.168.10.110" #example
- response = os.system("ping -c 1 " + hostname)
- if response != 0:
- hostname = "192.168.11.110" #example
- response = os.system("ping -c 1 " + hostname)
- if response != 0:
- print (hostname, 'is up!')
- else:
- # hostname = "1.1.1.1.1"
- print (hostname, 'is down!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement