parent
e0b88dfb63
commit
59accdd814
7 changed files with 108 additions and 99 deletions
@ -1,7 +1,8 @@ |
|||||||
#!/usr/bin/env python |
#!/usr/bin/env python3 |
||||||
|
|
||||||
from tools.zookeeper import Zookeeper |
from tools.zookeeper import Zookeeper |
||||||
|
|
||||||
z = Zookeeper() |
if __name__ == "__main__": |
||||||
z.set_device_power(False) |
z = Zookeeper() |
||||||
|
z.set_device_power(False) |
||||||
|
|
||||||
|
@ -1,25 +1,27 @@ |
|||||||
#!/usr/bin/env python |
#!/usr/bin/env python3 |
||||||
|
|
||||||
import os |
import os |
||||||
import sys |
import sys |
||||||
import time |
import time |
||||||
from tools.zookeeper import Zookeeper |
from tools.zookeeper import Zookeeper |
||||||
|
|
||||||
z = Zookeeper() |
|
||||||
z.set_device_power(True) |
|
||||||
|
|
||||||
def is_online(ip): |
def is_online(ip): |
||||||
return (os.system(f"ping -c 1 {ip} > /dev/null") == 0) |
return (os.system(f"ping -c 1 {ip} > /dev/null") == 0) |
||||||
|
|
||||||
ip = str(sys.argv[1]) |
if __name__ == "__main__": |
||||||
timeout = int(sys.argv[2]) |
z = Zookeeper() |
||||||
start_time = time.time() |
z.set_device_power(True) |
||||||
while not is_online(ip): |
|
||||||
print(f"{ip} not online yet!") |
|
||||||
|
ip = str(sys.argv[1]) |
||||||
|
timeout = int(sys.argv[2]) |
||||||
|
start_time = time.time() |
||||||
|
while not is_online(ip): |
||||||
|
print(f"{ip} not online yet!") |
||||||
|
|
||||||
if time.time() - start_time > timeout: |
if time.time() - start_time > timeout: |
||||||
print("Timed out!") |
print("Timed out!") |
||||||
raise TimeoutError() |
raise TimeoutError() |
||||||
|
|
||||||
time.sleep(1) |
time.sleep(1) |
||||||
|
|
||||||
|
@ -1,8 +1,10 @@ |
|||||||
#!/usr/bin/env python |
#!/usr/bin/env python3 |
||||||
|
|
||||||
import sys |
import sys |
||||||
from tools.zookeeper import Zookeeper |
from tools.zookeeper import Zookeeper |
||||||
|
|
||||||
z = Zookeeper() |
|
||||||
z.set_device_ignition(1 if int(sys.argv[1]) > 0 else 0) |
if __name__ == "__main__": |
||||||
|
z = Zookeeper() |
||||||
|
z.set_device_ignition(1 if int(sys.argv[1]) > 0 else 0) |
||||||
|
|
||||||
|
Loading…
Reference in new issue