<div dir="ltr">Thanks Alexander.  The bit about pre-stop was a great help for allowing me to mark when a job was meant to go down.<br><br>Does RESULT only get set to failed when respawn limit is reached or does it get set everytime the process dies?  I've tried to get EXIT_STATUS & EXIT_SIGNAL from the monitoring upstart job and haven't been successful yet (I tried killing the job repeatedly till it stopped respawning, having the job die from an abnormal exit on it's own, etc, nothing seems to work).  I'll keep poking at that myself.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 20, 2014 at 2:28 PM, Alexander Petrov <span dir="ltr"><<a href="mailto:alexxxbt@gmail.com" target="_blank">alexxxbt@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Mike,<div class="im"><br><div class="gmail_extra"><br></div><div class="gmail_extra">>> - A user stopped the job (stop job)<br>
</div></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>stop</tt>, the job will be started again. This
includes running <a href="http://upstart.ubuntu.com/cookbook/#pre-start" target="_blank">pre-start</a>, <a href="http://upstart.ubuntu.com/cookbook/#post-start" target="_blank">post-start</a> and <a href="http://upstart.ubuntu.com/cookbook/#post-stop" target="_blank">post-stop</a>. Note that
<a href="http://upstart.ubuntu.com/cookbook/#pre-stop" target="_blank">pre-stop</a> will not be run.<br></div><div class="gmail_extra"><div class="im"><br>>> - The job died repeatedly, passing the respawn limit and stayed down</div>
<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>* 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" target="_blank">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><div class="h5"><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></div></div><span class="HOEnZb"><font color="#888888">--<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></font></span></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Michael Barrett
</div>