From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/838 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Jo=EBl?= Riou Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Querying service status :: A suggestion Date: Tue, 9 Aug 2005 17:14:40 +0200 Message-ID: <20050809151440.GB13581@greement.salle-s.org> References: <1123590237.3174.72.camel@srinidhi.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1123600592 15599 80.91.229.2 (9 Aug 2005 15:16:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Aug 2005 15:16:32 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-1074-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Aug 09 17:16:24 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1E2VoR-00032f-7n for gcsg-supervision@gmane.org; Tue, 09 Aug 2005 17:14:43 +0200 Original-Received: (qmail 12518 invoked by uid 76); 9 Aug 2005 15:15:04 -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 12512 invoked from network); 9 Aug 2005 15:15:04 -0000 Original-To: B S Srinidhi Content-Disposition: inline In-Reply-To: <1123590237.3174.72.camel@srinidhi.com> User-Agent: Mutt/1.5.9i Xref: news.gmane.org gmane.comp.sysutils.supervision.general:838 Le mardi 9 août 2005, B S Srinidhi a écrit : > Whenever a service is sent a signal, the supervise/status file is > regenerated. (???) In other words, its creation time stamp gets changed. That seems true, the update_status() function in runsv.c creates a "supervise/status.new" file, store the information, and finally calls rename("supervise/status.new", "supervise/status") to atomically replace the previous status file. > So I thought that a simple stat() of supervise/status file could give me > the creation time and then a simple difftime() against the current > time(NULL) could give the last change status. > > Is this approach *sane*??? :) If not, then could someone please explain > the correct procedure? I do not really see why it may not be sane in usual configurations, but a more reliable way to do this is to use the information actually stored in supervise/status as the runsvstat program does ; the structure of this file is very simple, you will not have to embed an XML parser in your program :) -- Joël Riou