A doubt on Daemons

Hi there!

I'm a bit curious on something about Daemons....

Supose you have two processes say A and B, where B is a daemon.
A is totally independent from B.

Is there a way for A to find out B's return code?
Is there a way for A to find out when B ends?

Thanks!

Hi, there !
For the first question, I'm not sure... probably if you start it from a shell script or if you start it manualy, you can check the $? variable ( echo $? ).
For the second question, if A is a script shell or something like this, you can try this : ps aux | grep B_daemon_name. After this, like on the first question, check the $? variable. If it's value is 0, then everything is ok. If the value is 1 or something else, there was an error or your daemon is death :wink:
I hope this helped.
Good luck !

Thank you for your reply, but I was thinking of some kind of operating system function callable from a programming language interface, say C or Python. :rolleyes:

Saludos,
Mario.

Assuming both A and B are user processes (vs kernel process), as far as I know (I could be wrong), there is no way for A to catch exit status code of B. Exit status is returned to parent process only. In this scenario, the parent of daemon B is init. That means only the sceduler init would know the exit status of B.

Similar principle applies to the second question about ending time of daemon B. However, most of daemon logs its termination to syslog file via syslog daemon. That is where A might check to find out the ending time of B.
Tom

Thanks Tom!
Saludos,
Mario.