I would like to ask, I execute a program in the py script, how to determine whether the program is finished?

< H1 >! / usr/bin/python3 < / H1 >

import sys
import datetime
import os
import time
if name ="_ main__":

while 1:
    startTime=datetime.datetime.now()
    main_path="./main.py"
    py=sys.executable
    os.system(r"{} {} {} {}".format(py, main_path, sys.argv[1],sys.argv[2]))
    time.sleep(120)
    endTime = datetime.datetime.now()
    if endTime-startTime>60*60:
       break




is that the script may have been running for too long, and I judged that if it is still running within a long time, I will kill him

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Mar.04,2022

os.system returns 0 after the execution of the command, and 1 for failure. Check the returned value from another thread. Of course, you can also use a more advanced module to refer to here: https://www.cnblogs.com/hujq1.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaf847-48038.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaf847-48038.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?