<div dir="ltr">Shachar,<br><br>What you need is the functionality of a watchdog.<br>HA clusters provide this functionality. Anyhow, I guess you don't have/need an HA cluster, so what you might want to look at is monit: <a href="http://mmonit.com/monit/">http://mmonit.com/monit/</a><br>
I understand that you want to monitor it using your own daemon, but I don't believe that you can reinvent the wheel in a reasonable time and effort, so I point you to Monit.<br><br>- Noam<br><br><div class="gmail_quote">
On Sun, Feb 1, 2009 at 3:42 PM, Shachar Shemesh <span dir="ltr"><<a href="mailto:shachar@shemesh.biz">shachar@shemesh.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
I've been bad. I know I have. This goes against any instinct that I have, but I am failing to see a good reason WHY.<br>
<br>
The setup - I have an embedded system that is composed of several daemons. The situation is that one of the daemons has to restart another daemon. The restarted daemon (an SNMP agent) is outward facing, and therefor the time it takes it to restart should be minimized, if possible.<br>
<br>
Then again, it is a daemon. It has no parent (well, init is its parent). I can find it easily enough using its pid file, but I cannot get a notification when it has actually quit. There is an option to add to the SNMP the commands to send a notification to the other daemon when it exists, but this has several disadvantages I will not go into right now. I can also poll for the exit (i.e. - kill( pid, 0) every second until it says there is no such process), but that adds latency until I begin the restart process.<br>
<br>
So what I did was to use ptrace. The controlling daemon connects to the SNMP agent as a debugger, and this way gets notified with the usual "wait" interface when the agent exits. I am not doing any fancy register manipulation or any such stuff.<br>
<br>
Using ptrace as part of a production system feels wrong, but I cannot say exactly why. The small amount of experimentation I did with this system, as well as my extensive experience with ptrace when working on fakeroot-ng tell me that the interface is stable enough. Still, it feels wrong.<br>
<br>
Any feedback would be welcome.<br>
<br>
Shachar<br>
<br>
_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il" target="_blank">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
</blockquote></div><br></div>