X
X
XenK2015-06-14 17:32:57
PHP
XenK, 2015-06-14 17:32:57

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

2 answer(s)
B
BatteryLow, 2015-06-14
@BatteryLow

Use the standard Linux utility - flock ( example ), the launch of a new process will not occur until the execution of the previous one stops.

I
Igor Belikov, 2015-06-14
@igorbelikov

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 question

Ask a Question

731 491 924 answers to any question