<br><font size=2 face="sans-serif">Here's a scenario: I have two processes
- an application and a watchdog. The watchdog exercises the application
(instead of just checking its presence). If the watchdog sees that the
application health is poor, I want the application to be restarted. </font>
<br>
<br><font size=2 face="sans-serif">So inside the watchdog when it sees
bad health it will run &quot;initctl emit application-unhealthy&quot; and
stop exercising. But when the application is stopped, I also want the watchdog
to be stopped, so that the watchdog gets restarted in a clean state after
the application gets started, and the watchdog doesn't try to exercise
the application that isn't there. So here are the config files I put in
/etc/init:</font>
<br>
<br><font size=2 face="sans-serif">application.conf:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; start
on startup or application-kickstart</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; stop
on application-unhealthy</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; exec
/home/marcelk/application</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; respawn</font>
<br>
<br><font size=2 face="sans-serif">watchdog.conf:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; start
on started application</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; stop
on stopping application</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; exec
/home/marcelk/watchdog</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; respawn</font>
<br>
<br><font size=2 face="sans-serif">On boot both the application and watchdog
start. If I &quot;initctl emit application-unhealthy&quot; then only the
application stops, not the watchdog. </font>
<br>
<br><font size=2 face="sans-serif">I did a &quot;initctl log-level debug&quot;
before the &quot;initctl emit application-unhealthy&quot; and it says it
is completing the stopping and stopped events for application, but there
is no reference to watchdog. Am I correct to understand that this should
work as I expect?</font>
<br>
<br><font size=2 face="sans-serif">Another option would be for the watchdog
to explicitly invoke &quot;initctl restart application&quot; and for the
watchdog itself to stay up during the application restart. Would that initctl
invocation block until the application was stopped and restarted?</font>
<br>
<br><font size=2 face="sans-serif">What would be nice is a &quot;restart
on ...&quot; stanza. I could also see that an &quot;restart limit ...&quot;
stanza should follow.</font>
<br>
<br><font size=2 face="sans-serif">Given the way that upstart was designed,
any other models I should look at for an elegant application/watchdog functionality?
Thanks!</font>
<br>