Re: How to redirect to /run/uncaught-logs/current?

From: Laurent Bercot <ska-supervision_at_skarnet.org>
Date: Wed, 02 Nov 2016 23:22:23 +0000

>#!/bin/execlineb -P
>if { s6-test -d /home/data1/protected/Work }
>s6-setuidgid admin
>backtick -n HOME { homeof admin }
>/usr/bin/screen -S emacs -D -m --
>/usr/bin/emacs --user admin --chdir /home/data1/protected

  I still believe that the screen is unnecessary and you can manage an
emacs server with just (server-start) in an init file. But if it works
for you with a screen process, why not - since you're using emacs,
smallness and efficiency are out the window anyway.


>background { s6-echo "Starting PostgreSQL Database" }

  You may want to change that to "foreground". s6-echo is a very short-
lived program, running it in parallel doesn't bring you any benefits
and may cause trouble in a few cases (unlikely here, but possible in
the general case).


>I have acpid, and I wish that output from acpid is going to
>/run/uncaught-logs/current, and I have it like this, and I get on boot
>screen, the messages:

  In addition to what Colin said: acpid and udevd both log to syslog by
default, so if you want them to log to stderr instead, you'll have to
use specific options to avoid it.

  For acpid, it's "acpid -d" : the only way to get stderr logging is to
specify one level of debugging. (This is bad engineering from the
authors
of acpid.)

  For udevd, I'm not sure whether it's possible. "udevd --debug" will
print
debug messages to stderr, but the documentation doesn't specify whether
it also sends the normal log messages to stderr or it keeps sending them
to syslog, or sends them to both. (This is *terrible* engineering from
the author of udevd, especially since udevd is supposed to run very
early,
typically way before a syslogd server is started. The author of udevd
is Kay Sievers, so I guess it's not a surprise.)


>redirfd -wnb 1 /run/service/s6-svscan-log/fifo
>foreground { /sbin/ifconfig eth0 up }
>exec -c
>/sbin/ifconfig eth0 10.0.0.1 up

  You don't need all that. By default, a oneshot will print messages to
s6-svscan's stdout or stderr, which will be the catch-all fifo if you
use s6-linux-init-maker -r (as Colin said). Also, ifconfig will
automatically bring up an interface when you assign an IP to it, so
you don't need to call it twice - and it's actually a bad idea to bring
it up before giving it an IP, unless you're running a DHCP client on it.
So here your script can simply be rewritten as
  /sbin/ifconfig eth0 10.0.0.1
which is a lot simpler. :)


>[ 8.238909] 0000:05:00.0: Missing Free firmware ....
>
>I am not concerned about firmware, I just wish to redirect that output
>to /run/uncaught-logs/current.

  This is likely a kernel message. You won't be getting those in the
catch-all logger, because they don't follow the user-space logging
chain.
If you want to log them, set up a klogd service.


>Further, I would like to implement on the source based GNU/Linux
>system here, the /etc/execline-shell and /etc/execline-startup, where
>are those scripts? I have searched all skarnet packages, and could not
>find it yet. I would like some examples from other people.

  My bad. I retired those scripts long ago because they are way out of
scope for execline - I use such scripts in my own setup, but they're
complete policy so they don't belong in the execline package. I see
I did not remove the mention of those scripts in the documentation; that
was a mistake, sorry about that.


>It would be good that people using skarnet tools, s6-rc services,
>publish their services onto git or Internet, so that it becomes
>reusable for others to set up the system.

  I will work on such a thing at some point next year.

--
  Laurent
Received on Wed Nov 02 2016 - 23:22:23 UTC

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