Answer the question
In order to leave comments, you need to log in
Stop script execution?
The script (php) runs every 5 minutes via cron, but cron can run in the range from 290 seconds to 310, that is, with an error. It is necessary to exclude the re-run of the script, one of the options is to stop the running script and start it again. What do you advise?
Answer the question
In order to leave comments, you need to log in
Use the standard Linux utility - flock ( example ), the launch of a new process will not occur until the execution of the previous one stops.
If I understand you correctly, then you need to store its state and see if it is running now. If so, then stop working, otherwise execute and update the current state.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question