<div dir="ltr">Hi Mike,<br><div class="gmail_extra"><br></div><div class="gmail_extra">>> - A user stopped the job (stop job)<br></div><div class="gmail_extra">In this case pre-stop will be called (in the 2nd and 3rd case only post-stop will be called)<br>
</div><div class="gmail_extra">* With this stanza, whenever the main script/exec exits, without the goal of the
job having been changed to <tt class="">stop</tt>, the job will be started again. This
includes running <a class="" href="http://upstart.ubuntu.com/cookbook/#pre-start">pre-start</a>, <a class="" href="http://upstart.ubuntu.com/cookbook/#post-start">post-start</a> and <a class="" href="http://upstart.ubuntu.com/cookbook/#post-stop">post-stop</a>. Note that
<a class="" href="http://upstart.ubuntu.com/cookbook/#pre-stop">pre-stop</a> will not be run.<br></div><div class="gmail_extra"><br>>> - The job died repeatedly, passing the respawn limit and stayed down<div>upstart will send 'stopped' event with RESULT=failed (env variable).<br>
</div><div>You can write a job-failhandler which is called in case if you job exhaust respawn limit and totally failed :<br><pre class="">* start on stopped job-A RESULT=failed</pre>I have a feeling that in upstart 1.5 that variable was available from post-stop of a failed job but in upstart 1.10 it isn't true.<br>
</div><div>BTW, second case doesn't lead to a 'stopped RESULT=failed' event. Second case won't lead to this in case if pre-stop succeeded. <br></div><br></div><div class="gmail_extra">Guess `failhandler` job is usual way to do what you want (<a href="http://upstart.ubuntu.com/cookbook/#run-a-job-only-if-another-job-fails">http://upstart.ubuntu.com/cookbook/#run-a-job-only-if-another-job-fails</a>).<br>
<br></div><div class="gmail_extra"><div class="gmail_quote">2014/1/21 Michael Barrett <span dir="ltr"><<a href="mailto:loki77@gmail.com" target="_blank">loki77@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi - is there anyway to tell the difference between these three scenarios with an upstart job (that has respawn enabled):<div>

<br></div><div>- A user stopped the job (stop job)</div><div>- The job died and restarted successfully</div>
<div>- The job died repeatedly, passing the respawn limit and stayed down</div><div><br></div><div>Thanks! </div><div><br>What I'm trying to do is monitor a process (our monitoring system actually) to tell when/if it dies.  Being able to differentiate the first of my examples from the other two is the most important for me, since I don't want to alert anyone if the monitoring system was disabled on purpose.<span><font color="#888888"><br clear="all">


<div><br></div>-- <br>Michael Barrett
</font></span></div></div>
<br>--<br>
upstart-devel mailing list<br>
<a href="mailto:upstart-devel@lists.ubuntu.com" target="_blank">upstart-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/upstart-devel" target="_blank">https://lists.ubuntu.com/mailman/listinfo/upstart-devel</a><br>
<br></blockquote></div><br></div></div>