From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/869 Path: news.gmane.org!not-for-mail From: Gerrit Pape Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: runit - access to run script's exit status for finish? Date: Thu, 15 Sep 2005 09:33:29 +0000 Message-ID: <20050915092844.4037.qmail@6530944879c9e2.315fe32.mid.smarden.org> References: <20050530074233.GA17439@skarnet.org> <20050531114539.16382.qmail@6607a8c5b39a0b.315fe32.mid.smarden.org> <20050531190911.25938.qmail@adf4e649eec508.315fe32.mid.smarden.org> <20050601000521.GB32490@grummit.biaix.org> <20050827192438.24239.qmail@573d30f8a31845.315fe32.mid.smarden.org> <20050829080807.24479.qmail@b57f7a37a4464e.315fe32.mid.smarden.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126776550 11395 80.91.229.2 (15 Sep 2005 09:29:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Sep 2005 09:29:10 +0000 (UTC) Original-X-From: supervision-return-1105-gcsg-supervision=m.gmane.org@list.skarnet.org Thu Sep 15 11:29:06 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1EFq2a-0008CD-1C for gcsg-supervision@gmane.org; Thu, 15 Sep 2005 11:28:24 +0200 Original-Received: (qmail 12665 invoked by uid 76); 15 Sep 2005 09:28:45 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 12660 invoked from network); 15 Sep 2005 09:28:45 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.comp.sysutils.supervision.general:869 Archived-At: On Mon, Sep 12, 2005 at 10:11:58AM -0500, Charles Duffy wrote: > Gerrit Pape wrote: > >This sounds like a very good idea. I didn't re-check, but it should be > >possible to extend the supervise/status file by two bytes, being the > >last return code from ./run and ./finish, initially 0, without breaking > >backward compatibility. > > From what I've seen from the code so far, I agree that there shouldn't > be backwards-compatibility issues. > > However, on actually attempting to implement the interface we discussed, > I've found it to be somewhat inadequate: It permits the user to retrieve > the last exit status, but does *not* have any way to track there has > been any exit at all within this run, nor whether the program terminated > via a signal without calling exit() [and thus without setting an exit > status]. > > I'm considering extending by sizeof(int)*2 and storing wait()'s output > verbatim; that way, WIFEXITED/WIFSIGNALED/WTERMSIG/WEXITSTATUS are all > available, and it's possible to determine if the last exit was via a > signal (and if so, what). > > This leaves open the question of how to expose this information to the > user. I'm considering the following: > > -r: last exit type and value for ./run > -f: last exit type and value for ./finish > > could return instead of , :, as in "signal:11", "exit:0", > "exit:1" or "none:0" (if there has, as of yet, been no exit). > > Thoughts? It's a good idea to include this additional information into supervise/status. What I'm not sure about is the output ":". How about simply having the exit code (0-255) printed if ./run terminated cleanly, the signal number prefixed with '-' if it terminated due to an uncatched signal, and nothing if ./run didn't terminate at all yet?: # sv status -r . 0 # ./run terminated with return code 0. # sv status -r . -13 # ./run terminated due to uncatched SIGPIPE. # sv status -r . # ./run didn't terminate yet, since the supervisor started. Regards, Gerrit.