Anyway to tell if a job was stopped on purpose?
Alexander Petrov
alexxxbt at gmail.com
Mon Jan 20 22:28:29 UTC 2014
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 <loki77 at gmail.com>
> 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
> upstart-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/upstart-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20140121/7ea8a889/attachment.html>
More information about the upstart-devel
mailing list