<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 "initctl emit application-unhealthy" 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"> start
on startup or application-kickstart</font>
<br><font size=2 face="sans-serif"> stop
on application-unhealthy</font>
<br><font size=2 face="sans-serif"> exec
/home/marcelk/application</font>
<br><font size=2 face="sans-serif"> respawn</font>
<br>
<br><font size=2 face="sans-serif">watchdog.conf:</font>
<br><font size=2 face="sans-serif"> start
on started application</font>
<br><font size=2 face="sans-serif"> stop
on stopping application</font>
<br><font size=2 face="sans-serif"> exec
/home/marcelk/watchdog</font>
<br><font size=2 face="sans-serif"> respawn</font>
<br>
<br><font size=2 face="sans-serif">On boot both the application and watchdog
start. If I "initctl emit application-unhealthy" then only the
application stops, not the watchdog. </font>
<br>
<br><font size=2 face="sans-serif">I did a "initctl log-level debug"
before the "initctl emit application-unhealthy" 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 "initctl restart application" 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 "restart
on ..." stanza. I could also see that an "restart limit ..."
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>