Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(not time.sleep(hc_interval)):
- #
- # Set the stdout/stderr variables; we'll need the stdout one for the loop
- # to make sure the route is or isn't being sent
- result = subprocess.Popen(route_check, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- stdout,stderr = result.communicate()
- if isOpen(server, httpport) and urllib3.PoolManager().request('GET', url).status == 200:
- if not stdout.decode('utf-8'): # service is down
- subprocess.call(route_add, shell=True)
- else:
- if stdout.decode('utf-8'): # service is up
- subprocess.call(route_del, shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement