I have a problem with a script that is freezing in about 1% of the times it runs, as described here.
To avoid a running more than once at a times, the script creates a temporary file, which gets deleted if the script finished or if a PHP fatal error occured.
When the script freezes, this does not happen of course, and so everything gets stuck, since the next scheduled run will not start, as the temporary file still exists.
No one has managed so far to figure why the script is freezing, so in the meantime I think to use a "dirty" solution, by having the system kill the script if it takes longer than expected, which might mean it froze.
I can do it by running it like timeout -s KILL 1m php script..php which kills it after a minute, if I assume it should have finished within a minute.
However, killing it this way does not solve the temporary file issue, and therefore I want to know if there is a way to both kill it and generate a fatal error for the script, so it will delete the temp. file