diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2019-01-06 20:43:49 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2019-01-06 20:43:49 +0000 |
commit | 93c4146644ea2125fd13a971c456a9ffcf6a274d (patch) | |
tree | 5aa7383ae050ff0ec2d5855b49e544f5365648c7 /runprog.py | |
parent | b7b724c24220b9396e83787f6311082a9b6680e1 (diff) | |
download | SmallYTChannelBot-93c4146644ea2125fd13a971c456a9ffcf6a274d.tar.gz SmallYTChannelBot-93c4146644ea2125fd13a971c456a9ffcf6a274d.zip |
added feature that restarts the program every two hours and fixed one bug
Diffstat (limited to 'runprog.py')
-rw-r--r-- | runprog.py | 23 |
1 files changed, 23 insertions, 0 deletions
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) + |