This may seem odd but does anyone know a way to store a variable that only exists as long as apache is running or the PHP server is running?
Or is there some way to know when apache restarts?
I have a couple pages that run into trouble if for any reason they are running and apache restarts. Such as a server reboot or simply restarting the apache server from the command line.
I want to be able to do some clean-up if this situation is detected. I know I can create a file when the process starts and delete it after. Then if it is there when the process trys to start again clean-up is done first. But that is somewhat what I am doing except if that file exists I don't run the script because it could already be running and the script can only run one at a time. It is a visious cycle on this page.
Here is what I am doing in a nut shell so any ideas are welcome.
* Page loads
* If the magic file exists, notify the user and exit
* No file so create the magic file
* Do a long running process
* Delete magic file
The problem happens if apache restarts during the "Do a long running process" step.
Thanks for any suggestions.