supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Reason for s6-svscan -X
@ 2025-03-02 14:19 Paul Sopka
  2025-03-02 23:58 ` Laurent Bercot
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Sopka @ 2025-03-02 14:19 UTC (permalink / raw)
  To: supervision

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

Hey everyone,

a while ago I posted an init script here.
After fiddling with init a bit I wondered why
to not just redirect the stdout of s6-svscan-log
to /dev/console, instead of using s6-svscan -X.

I have used the configuration of s6-svscan without "-X"
and s6-svscan-log with something like:
"... fdmove -c 1 2 redirfd -a 1 /dev/console s6-log 1 ..."
and wonder if there is any drawback to that?

Regards,
Paul

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reason for s6-svscan -X
  2025-03-02 14:19 Reason for s6-svscan -X Paul Sopka
@ 2025-03-02 23:58 ` Laurent Bercot
  2025-03-03 18:46   ` Paul Sopka
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Bercot @ 2025-03-02 23:58 UTC (permalink / raw)
  To: supervision

>a while ago I posted an init script here.
>After fiddling with init a bit I wondered why
>to not just redirect the stdout of s6-svscan-log
>to /dev/console, instead of using s6-svscan -X.
>
>I have used the configuration of s6-svscan without "-X"
>and s6-svscan-log with something like:
>"... fdmove -c 1 2 redirfd -a 1 /dev/console s6-log 1 ..."
>and wonder if there is any drawback to that?

  The reason for -X is that s6-svscan and the s6-supervise process for
s6-svscan-log need to keep an fd to the real console as well (we cannot
hardcode /dev/console because on some systems it has another name).

  s6-svscan needs to restore its stdout and stderr to the real console
if it exits/panic. It also needs to spawn the supervisor for 
s6-svscan-log
with stderr pointing to the real console, because that supervisor cannot
assume that the s6-svscan-log fifo is always open for reading (and in
fact, at spawn time, it is not) so this s6-supervise instance also needs
to write its error messages to the real console.

  In short: the catch-all logger isn't the only process that needs to 
know
the real console, all its ancestors in the supervision tree do as well,
because they're "lower level" than the catch-all logger.

--
  Laurent


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reason for s6-svscan -X
  2025-03-02 23:58 ` Laurent Bercot
@ 2025-03-03 18:46   ` Paul Sopka
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Sopka @ 2025-03-03 18:46 UTC (permalink / raw)
  To: Laurent Bercot, supervision

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

> 
>   The reason for -X is that s6-svscan and the s6-supervise process for
> s6-svscan-log need to keep an fd to the real console as well (we cannot
> hardcode /dev/console because on some systems it has another name).
> 
With my scripted approach I need to do "... redirfd -a 3 /dev/console s6-svscan -X3 ...",
so I need to write a special "compatible" script for all kernels anyway.

>   s6-svscan needs to restore its stdout and stderr to the real console
> if it exits/panic. It also needs to spawn the supervisor for 
> s6-svscan-log
> with stderr pointing to the real console, because that supervisor cannot
> assume that the s6-svscan-log fifo is always open for reading (and in
> fact, at spawn time, it is not) so this s6-supervise instance also needs
> to write its error messages to the real console.
> 
>   In short: the catch-all logger isn't the only process that needs to 
> know
> the real console, all its ancestors in the supervision tree do as well,
> because they're "lower level" than the catch-all logger.
> 
> --
>   Laurent
> 
Thank you for explaining,
Paul

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-03 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-02 14:19 Reason for s6-svscan -X Paul Sopka
2025-03-02 23:58 ` Laurent Bercot
2025-03-03 18:46   ` Paul Sopka

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