parent
bb156e50d7
commit
116ae68bdb
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 |
||||
|
||||
z = Zookeeper() |
||||
z.set_device_power(False) |
||||
if __name__ == "__main__": |
||||
z = Zookeeper() |
||||
z.set_device_power(False) |
||||
|
||||
|
@ -1,25 +1,27 @@ |
||||
#!/usr/bin/env python |
||||
#!/usr/bin/env python3 |
||||
|
||||
import os |
||||
import sys |
||||
import time |
||||
from tools.zookeeper import Zookeeper |
||||
|
||||
z = Zookeeper() |
||||
z.set_device_power(True) |
||||
|
||||
def is_online(ip): |
||||
return (os.system(f"ping -c 1 {ip} > /dev/null") == 0) |
||||
|
||||
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 __name__ == "__main__": |
||||
z = Zookeeper() |
||||
z.set_device_power(True) |
||||
|
||||
|
||||
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: |
||||
print("Timed out!") |
||||
raise TimeoutError() |
||||
if time.time() - start_time > timeout: |
||||
print("Timed out!") |
||||
raise TimeoutError() |
||||
|
||||
time.sleep(1) |
||||
time.sleep(1) |
||||
|
||||
|
@ -1,8 +1,10 @@ |
||||
#!/usr/bin/env python |
||||
#!/usr/bin/env python3 |
||||
|
||||
import sys |
||||
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