forked from Mazen030/Team43-AWS_Distributed_system_project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
28 lines (26 loc) · 1009 Bytes
/
run.py
File metadata and controls
28 lines (26 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import subprocess
import logging
import time
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def execute_try_py():
"""
Execute the try.py script.
"""
try:
logging.info("Executing fallback script try.py")
while True:
try:
time.sleep(10)
logging.info("##########################################!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
subprocess.run(["python3", "try.py"], check=True)
time.sleep(10)
subprocess.run(["python3", "try.py"], check=True)
#subprocess.run(["python3", "try.py"], check=True)
except Exception as e:
logging.error(f"Error executing try.py: {e}")
time.sleep(5) # Wait for 5 seconds before retrying
except KeyboardInterrupt:
logging.info("Exiting run.py due to keyboard interrupt.")
if __name__ == "__main__":
execute_try_py()