Re: detect service crashes

From: Alex Efros <powerman_at_powerman.name>
Date: Fri, 6 Sep 2013 18:15:39 +0300

Hi!

On Fri, Sep 06, 2013 at 10:16:15AM -0400, Charlie Brady wrote:
> > Is it possible to somehow detect in ./finish script is it was called
> > because ./run just exited/crashed on it's own, or because ./run was killed
> > by `sv t` (manually) or `sv force-stop` (while server shutdown)?
>
> Two arguments are given to ./finish. The first one is ./runs exit code,
> or -1 if ./run didnt exit normally. The second one is the least significant
> byte of the exit status as determined by waitpid(2); for instance it is 0
> if ./run exited normally, and the signal number if ./run was terminated by
> a signal. If runsv cannot start ./run for some reason, the exit code is
> 111 and the status is 0.

This isn't what I asked for. And, sadly, this won't work in my case.

The services I'm talking about are unusual enough - it's OS Inferno's
virtual machine (/usr/inferno/Linux/386/bin/emu-g). Thing is, it's
implemented as multi-thread application, which internally handle exit by
killing it's group of threads. So, when my application inside Inferno
crash or raise exception, or even exit normally - any of these events
result in main Inferno thread send kill-group signal to itself.

As result, ./finish script always called with $1=-1 and $2=9 - both when
service crash and when I manually run `sv t`.

-- 
			WBR, Alex.
Received on Fri Sep 06 2013 - 15:15:39 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC