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.
- Which OS are you working on?toti08– toti082018-11-21 10:28:13 +00:00Commented Nov 21, 2018 at 10:28
- I am on a google cloud vm, Debian GNU/LINUXguigui dm– guigui dm2018-11-21 10:31:50 +00:00Commented Nov 21, 2018 at 10:31
- You could maybe use the sched python library?toti08– toti082018-11-21 10:36:37 +00:00Commented Nov 21, 2018 at 10:36
Add a comment |
2 Answers
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