type shadowboxing, win compatibility

This commit is contained in:
iRaven 2024-02-21 02:10:55 -06:00
parent 279a7be3e7
commit 39449ac9a2
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@
"chkinterval": "", "chkinterval": "",
"filepath": "", "filepath": "",
"srcurl": "", "srcurl": "",
"os": "",
"server": "", "server": "",
"port": "", "port": "",
"ssh-user": "", "ssh-user": "",

View File

@ -18,7 +18,11 @@ shcommands = []
def healthcheck(): def healthcheck():
global healthstatus global healthstatus
response = os.system("ping -c 2 " + cfg["server"] + ">> /dev/null") response = ""
if cfg["os"] == "win":
response = os.system("ping -n 2 " + cfg["server"])
else:
response = os.system("ping -c 2 " + cfg["server"] + ">> /dev/null")
if response != 0: if response != 0:
healthstatus = "err" healthstatus = "err"
else: else:
@ -69,4 +73,5 @@ while True:
break break
else: else:
print("Got a response! health status is ok.") print("Got a response! health status is ok.")
time.sleep(cfg["chkinterval"]) # we will run this loop every X seconds, defined by checkinterval print("Trying again in " + cfg["chkinterval"] + " seconds.")
time.sleep(int(cfg["chkinterval"])) # we will run this loop every X seconds, defined by checkinterval