supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* stdout of check script (change proposal)
@ 2019-10-16  7:03 tomas.volf
  0 siblings, 0 replies; only message in thread
From: tomas.volf @ 2019-10-16  7:03 UTC (permalink / raw)
  To: supervision; +Cc: david.cepelik

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-16  7:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16  7:03 stdout of check script (change proposal) tomas.volf

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).