I have created a script that checks if some other script is running
import os
import datetime
import time
from time import ctime
statinfo = os.stat('nemo_logs/nemo_log_file_' + time.strftime('%Y-%m-%d') + '.txt')
for i in range(1):
first_size = statinfo.st_size
time.sleep(10)
if statinfo.st_size > first_size:
print("SCRIPT IS RUNNING")
else:
print("SCRIPT IS NOT RUNNING. TRYING TO KILL THE SCRIPT...")
os.system("pkill -9 -f selenium_nemo.py")
print("SCRIPT KILLED. TRYING TO RESTART THE SCRIPT...")
os.system("python selenium_nemo.py")
print("SCRIPT STARTED")
If the script logs are increasing then we are OK, but if the script has stuck for some case i want to stop it and restart the script once more.
First i kill the script and then i'am executing os.system("python selenium_nemo.py")
. The script starts but it runs inside my main script. How i can i start the selenium_nemo.py
on another proccess?
'The for loop is for later'
Thanks