Thanks Alexander.  The bit about pre-stop was a great help for allowing me
to mark when a job was meant to go down.

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.


On Mon, Jan 20, 2014 at 2:28 PM, Alexander Petrov <[email protected]>wrote:

> Hi Mike,
>
>
> >> - A user stopped the job (stop job)
> In this case pre-stop will be called (in the 2nd and 3rd case only
> post-stop will be called)
> * With this stanza, whenever the main script/exec exits, without the goal
> of the job having been changed to stop, the job will be started again.
> This includes running 
> pre-start<http://upstart.ubuntu.com/cookbook/#pre-start>,
> post-start <http://upstart.ubuntu.com/cookbook/#post-start> and 
> post-stop<http://upstart.ubuntu.com/cookbook/#post-stop>.
> Note that pre-stop <http://upstart.ubuntu.com/cookbook/#pre-stop> will
> not be run.
>
> >> - The job died repeatedly, passing the respawn limit and stayed down
> upstart will send 'stopped' event with RESULT=failed (env variable).
> You can write a job-failhandler which is called in case if you job exhaust
> respawn limit and totally failed :
>
> * start on stopped job-A RESULT=failed
>
> 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.
> 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.
>
> Guess `failhandler` job is usual way to do what you want (
> http://upstart.ubuntu.com/cookbook/#run-a-job-only-if-another-job-fails).
>
> 2014/1/21 Michael Barrett <[email protected]>
>
>> Hi - is there anyway to tell the difference between these three scenarios
>> with an upstart job (that has respawn enabled):
>>
>> - A user stopped the job (stop job)
>> - The job died and restarted successfully
>> - The job died repeatedly, passing the respawn limit and stayed down
>>
>> Thanks!
>>
>> 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.
>>
>> --
>> Michael Barrett
>>
>> --
>> upstart-devel mailing list
>> [email protected]
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
>>
>>
>


-- 
Michael Barrett
-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to