Reputation: 1098
I need to write shell script, which will run PHP script every x seconds. And I need to be sure, that previous execution has finished.
Is it possible to run PHP script from shell and (for example) wait for "done" message from PHP?
Upvotes: 0
Views: 1200
Reputation: 3437
what if the script dies and fails to return a "done" message?
what if the script returns an error?
There are any number of situations where this is probably not the optimal way to deal with your problem.
You may be better off writing a process ID file (PID) when the script starts running. using getmypid()
The when it is time to execute it again, check the PID file, if it is stale and the process has finished then run again, else exit without running as the old process is still active.
Upvotes: 1