turtle-wow-source-kinda/Dumps/Source Code/20 - Development_turtle-logs/main/Deploy/scheduler.py

30 lines
707 B
Python
Raw Normal View History

2024-08-06 16:06:40 +00:00
from werkzeug.wrappers import Request, Response
from threading import Thread
import subprocess
import time
class DeployWorker(Thread):
def __init__(self):
Thread.__init__(self)
self.deploy = False
def run(self):
while True:
if self.deploy:
self.deploy = False
subprocess.call(["/bin/bash", "/root/LegacyPlayersV3/Deploy/deploy.sh"])
else:
time.sleep(1)
globalThread = 0
@Request.application
def application(request):
globalThread.deploy = True
return Response("Ok!")
if __name__ == "__main__":
globalThread = DeployWorker()
globalThread.start()
from werkzeug.serving import run_simple
run_simple("0.0.0.0", 55555, application)