supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: tomas.volf@showmax.com
To: supervision@list.skarnet.org
Cc: david.cepelik@showmax.com
Subject: stdout of check script (change proposal)
Date: Wed, 16 Oct 2019 09:03:54 +0200	[thread overview]
Message-ID: <20191016070354.6krcu2v45msevxhb@showmax.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

Hello,

I would like to propose a small change in runit.

I was surprised by the way runit executes the check script.
Looking at the current sources from the tarball (2.1.2), I've
noticed that stdout is closed before check script gets execve'd:

admin/runit-2.1.2/src/sv.c:
    195   if (!pid) {
    196     prog[0] ="./check";
    197     prog[1] =0;
    198     close(1);
    199     execve("check", prog, environ);

Perhaps there's some motivation I don't know? I would propose
one of the following:

    a) keep both stdout and stderr open,
    b) close both stdout and stderr,
    c) if we don't care about the output, dup2 both to /dev/null.

The current behavior can be a bit confusing. For example, we
exec 2>&1 in most of our run-files so that output of the entire
script is logged with svlogd. If you attempt to do that in the
check file, the script will crash (because FD 1 is closed) and
if you're using dash, you won't even get an error message (that's
another bug to be fixed which was discovered while debugging the
check script issue).

a) has the advantage of seeing the output of the check script
when issuing commands on the terminal.

If we can agree on a solution, we are more than happy to provide
a patch for this.

Big thanks for runit!

Regards
W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2019-10-16  7:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191016070354.6krcu2v45msevxhb@showmax.com \
    --to=tomas.volf@showmax.com \
    --cc=david.cepelik@showmax.com \
    --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).