Use crontab to execute scheduled tasks, There are two methods to handle it
Kill the process regularly every day and re-execute your command
Fix the file name of a log and rename the log file according to date regularly every day. The second method does not require stopping the application, but you can also customize the granularity of the log files yourself. You can have one file per hour~
Execution order issue, the code inside "``" is executed first, and the execution result is nested in the outer command as a string
eventually became
Through the
ps
command you can see that there is only one processpython demo.py
ps
命令你可以看到只有一个进程python demo.py
即使过了
Even after00:00
00:00
, the PID of the process will not changeUse crontab to execute scheduled tasks,
There are two methods to handle it
Kill the process regularly every day and re-execute your command
Fix the file name of a log and rename the log file according to date regularly every day.
The second method does not require stopping the application, but you can also customize the granularity of the log files yourself. You can have one file per hour~