From 93c4146644ea2125fd13a971c456a9ffcf6a274d Mon Sep 17 00:00:00 2001 From: jwansek <eddie.atten.ea29@gmail.com> Date: Sun, 6 Jan 2019 20:43:49 +0000 Subject: added feature that restarts the program every two hours and fixed one bug --- runprog.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 runprog.py (limited to 'runprog.py') diff --git a/runprog.py b/runprog.py new file mode 100644 index 0000000..a564678 --- /dev/null +++ b/runprog.py @@ -0,0 +1,23 @@ +from time import sleep +import subprocess +import multiprocessing + +def thread_(): + subprocess.run(["python3", "SmallYTChannelBotSubmissions.py"]) + +while True: + thread = multiprocessing.Process(target = thread_, args = ()) + thread.start() + + sleep(60 * 60 * 2) + + #print("closing...") + #file = open("pid.txt", "r") + #pid = file.readlines()[0] + #file.close() + + #subprocess.run(["kill", pid]) + thread.terminate() + + #print("killed ", pid) + -- cgit v1.2.3