supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: "Joël Riou" <joel.riou@normalesup.org>
Cc: supervision@list.skarnet.org
Subject: Re: Querying service status :: A suggestion
Date: Tue, 9 Aug 2005 17:14:40 +0200	[thread overview]
Message-ID: <20050809151440.GB13581@greement.salle-s.org> (raw)
In-Reply-To: <1123590237.3174.72.camel@srinidhi.com>

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



      reply	other threads:[~2005-08-09 15:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-09 12:23 B S Srinidhi
2005-08-09 15:14 ` Joël Riou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050809151440.GB13581@greement.salle-s.org \
    --to=joel.riou@normalesup.org \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).