in reply to One process at a time
Hi,
Normally you do the stop/start/restart etc things using a external sh script that do the job...
And in your daemon you check on startup if another instance is still running, if so, then exit
Once your program/daemons ends, because, normally a signal it receives (15, 9), the program/daemon should remove the PID file
You can say, ok, if the daemon exits because any fault, I don't let him start again, because there is a untreated error... that's made automatically if you only check the PID file, and not the second one, to see if this PID number is valid...
If you want that this program/daemon is running forever, you can include it in the init or check it with any tool, like 'supervise', from D.J.Bernstein, see daemontools...
Don't try the complicated approach, the status report can be get from a log/status file that your daemon write. For example like AMANDA does.
Read some text about daemons and UNIX... there you'll get all the things well explained.
And remember, K.I.S.S. (Keep It Simple Stupid)
Regards,
|
|---|