supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Understanding the syslogd-linux Service Script
@ 2020-09-08 16:53 Scott Colby
  2020-09-08 18:15 ` Colin Booth
  2020-09-08 18:43 ` Colin Booth
  0 siblings, 2 replies; 8+ messages in thread
From: Scott Colby @ 2020-09-08 16:53 UTC (permalink / raw)
  To: supervision

Hello,

I am faced with running a program in a container that will only log
to syslog and cannot be configured otherwise. I am looking to using
s6 within the container to supervise this program and some
implementation of syslog. I thought that there must be something
simpler than rsyslog or syslog-ng, and my investigations led me to
the s6/examples/syslogd-linux service directory.

I am only slightly experienced with writing execline scripts and
would like to better understand exactly what each line in the example
run script is doing. Here it is, annotated with my understanding
and questions.

#!/command/execlineb -P
# Redirects stderr to stdout, but why is this necessary?
fdmove -c 2 1
# Clears the environment, I assume for general
# security/isolation/cleanliness reasons?
exec -c
# Prepares for setting uid/gid later
s6-envuidgid nobody
# Redirects stdout to fd 3, I think because s6-ipcserver closes fd
# 1; what happens to things sent to fd 3?
# Also, why is the -c option not used here?
fdmove 1 3
# Listens on /dev/log, this makes sense to me
s6-ipcserver -U -1 -- /dev/log
# Redirects stdout to stderr, because this is where log messages
# are expected to go
fdmove -c 1 2
# writes stdin to stdout with the values of the remote UID and GID
# prepended, plus whatever other functionality of ucspidlogd
ucspilogd IPCREMOTEEUID IPCREMOTEEGID

Please let me know if I have made any mistakes in my annotation and
what the answers to my questions are.

Thank you,
Scott

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

end of thread, other threads:[~2020-09-12 18:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08 16:53 Understanding the syslogd-linux Service Script Scott Colby
2020-09-08 18:15 ` Colin Booth
2020-09-08 18:43 ` Colin Booth
2020-09-09  8:01   ` Laurent Bercot
2020-09-12  6:42     ` Scott Colby
2020-09-12 10:08       ` Laurent Bercot
2020-09-12 10:14       ` Laurent Bercot
2020-09-12 17:59         ` Scott Colby

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