I would like to know if there is a tool to auto open and close a python script. For example, I would like my python script opens every 12 hours. In my script I have an infite loop. So after 12 hours, I need the script to be closed and reopened. Thank you.
You can use the watch command to open your script every 12 hours. More information on watch and an example: https://askubuntu.com/questions/430382/repeat-a-command-every-x-interval-of-time-in-terminal .
Closing the script can be done from within your script. More information and an example: Stop code after time period
一种解决方案是使用计时器创建主过程并启动或关闭子流程
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.