Re: s6-supervise: use of nosetsid

From: Laurent Bercot <ska-supervision_at_skarnet.org>
Date: Thu, 03 Dec 2020 21:34:18 +0000

>I remember occasionally using 'nosetsid' files for the convenience of
>being able to redirect the output of 'run' and 'finish' to /dev/tty
>(the controlling terminal of the shell I used to run s6-svscan) so
>that I could see certain messages during tests in which s6-svscan had
>its stdout & stderr redirected to a logger (typically, for emulating
>an s6-linux-init-like s6-svscan-as-process-1 scenario). I think it was
>for doing something like
>
>foreground {
> redirfd -w 1 /dev/tty
> echo "Some message I want displayed on my terminal"
>}

  Interesting. Would you be able to do the same thing with saving
/dev/tty as an extra file descriptor instead?

s6-svscan 3>&1 &

...

foreground {
   fdmove 1 3
   echo "Some message I want displayed on my terminal"
}

  Granted, this leaks a fd into all your services, but if it's for
terminal testing it shouldn't matter much. Otherwise, for maximum
hacking value, you could use the -X option to s6-svscan, which would
not leak the tty fd into all the services, but only transmit it as
s6-svscan-log's stderr - so in order to print something to the
terminal you'd have to send it to the catch-all logger, and configure
that logger with a filter that sends those messages to stderr. :)

  So, can you juggle fds to avoid nosetsid, or can't you do the same
thing without it?

--
  Laurent
Received on Thu Dec 03 2020 - 21:34:18 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC