hy,
in my script i run a exec() function to make a movie file with ffmpeg.
the problem is ffmpeg can run only 1 time on the server,
if 2 people are online on server and first one already run ffmpeg i want the second to wait until the first end the process
how to code this?
thank you
Set a lock somewhere.
When ffmpeg starts, set a flag in a file or a database table to mark it as in progress. Every time ffmpeg starts, have it check if the flag value is '1', and if so, wait and retry in 5 or 10 seconds. Then when the process ends, set the flag to '0'. Make sure if it crashes or your script has an error that the flag is set back to '0'.
Or, you could likely run the ffmpeg process as a different user, and have more than one running at once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With