From d19c95acace99fe6c081f162ef93926a7ee1a0ce Mon Sep 17 00:00:00 2001 From: J BORGOHAIN Date: Fri, 24 Jun 2022 00:00:43 +0530 Subject: [PATCH] Restart/rerun the main.py script automatically This will rerun or re-execute the main.py script automatically once it disrupted or killed by any error. When I try to execute the main script multiple times by using TIMES_TO_RUN="n" feature sometimes the script stopped by some errors like timeout or sox not found, then I need to restart the script again and again so I wrote this to automate the restarting part.if anyone wants to rerun the script for n number of times then they can by rewriting the while loop to run exactly n times. --- restart.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 restart.py diff --git a/restart.py b/restart.py new file mode 100644 index 0000000..231c543 --- /dev/null +++ b/restart.py @@ -0,0 +1,6 @@ +import os +while 1: + os.system("python3 main.py") + print("Restarting......") + +# if you want to restart the main Script automatically 'n' number of times then rewrite the while loop to run 'n' times. \ No newline at end of file