I don't know if you need a phony pid or if you can just check something in the firewall as we do with Linux.
I can do that fine.
My question would be what are the requirements for making Service Monitor work properly? I don't understand its architecture. If it works like watchdog scripts, it checks the pid, which holds the process number for the daemon. When a daemon closes, it removes the pid. When the process terminates unexpectedly, it leaves the pid behind, but the watchdog figures that out by checking to see if the process in the pid is running in memory, and if not, restarts it. Perhaps Service Monitor works the same way?
IF Service Manager does work that way, I would need to write a daemon. We'll call it pfmonit.
- If Service Monitor calls the pfmonit's rc.d script with the start parameter, the script would call pf's rc.d script with the start option, then call the pfmonit daemon, and then create a pid with pfmonits process number.
- If Service Monitor calls the rc.d script with the stop parameter, the script would call pfmonit's rc.d script with the stop option, at which time pfmonit would call pf's rc.d script with the stop parameter, then kill pfmonit, and then remove pfmonit's pid.
- Restarts simply combine the first second and first option as usual.
- The only thing the daemon would do is monitor the status of the firewall. If something goes wrong, the daemon would simply need to do is exit. The Service Monitor during normal checks would find the pid no longer points to a valid process, and issue a call to pfmonit's rc.d script to get it running again.
Any thoughts, simplifications, or corrections?
Thanks