From 779b32e73b77648ba28c5b20e1a9b3fee43b64e8 Mon Sep 17 00:00:00 2001 From: majmongoose <ceb5150@gmail.com> Date: Fri, 25 Oct 2024 11:21:06 -0400 Subject: [PATCH] Revert "more attempts" This reverts commit 94423eaa9ae6144de6cec486dd3fbd3fd37fee23. --- pagebot.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pagebot.py b/pagebot.py index 6df316c..4e390ad 100644 --- a/pagebot.py +++ b/pagebot.py @@ -93,6 +93,8 @@ async def upload_to_discord(mp4_file,text): else: print(f"Could not find channel with ID {channel}") +from datetime import datetime + def launch_and_watch(program_path): program_directory = os.path.dirname(program_path) @@ -102,15 +104,8 @@ def launch_and_watch(program_path): restart_hour, restart_minute = map(int, restart_time.split(":")) restart_triggered = False # Flag to prevent multiple restarts within the same minute - process = None # Initialize the process variable outside the loop while True: - # If a process is already running, terminate it before starting a new one - if process and process.poll() is None: - print("Terminating the existing TTD process before restarting...") - process.terminate() - process.wait() - # Launch the TTD program print("Starting TTD program...") process = subprocess.Popen(program_path, cwd=program_directory) @@ -143,7 +138,6 @@ def launch_and_watch(program_path): print("Waiting before relaunching TTD...") time.sleep(2) - if __name__ == "__main__": ## initialize watchdogs