25 lines
535 B
Python
25 lines
535 B
Python
import subprocess
|
|
import time
|
|
import os
|
|
|
|
def restart_script():
|
|
|
|
while True:
|
|
process = subprocess.Popen(["python", "manage.py", "ingester"])
|
|
time.sleep(7200)
|
|
if os.path.exists("ingester_done.flag"):
|
|
# Remove the flag file
|
|
os.remove("ingester_done.flag")
|
|
print("Ingester done, exiting monitor script.")
|
|
break
|
|
|
|
process.terminate()
|
|
process.wait()
|
|
print("Restarting ingester...")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
restart_script()
|
|
|
|
|