summary refs log tree commit diff
path: root/os/etc/s6-rc/make-logservice
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2023-09-25 11:56:34 +0200
committerRobert Günzler <r@gnzler.io>2023-09-25 11:56:34 +0200
commitf5c219983c0f60a07f1bd52b6f6071e86f35455e (patch)
treeb7520a02b9822481f29aea4ccb404744a73414b1 /os/etc/s6-rc/make-logservice
parent91ba318df1ff9b04d08af373ae904f61a91bf489 (diff)
add os config
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'os/etc/s6-rc/make-logservice')
-rwxr-xr-xos/etc/s6-rc/make-logservice38
1 files changed, 38 insertions, 0 deletions
diff --git a/os/etc/s6-rc/make-logservice b/os/etc/s6-rc/make-logservice
new file mode 100755
index 0000000..da53a75
--- /dev/null
+++ b/os/etc/s6-rc/make-logservice
@@ -0,0 +1,38 @@
+#!/bin/sh
+set -eu
+
+sv=${1?:need service name.}
+basedir=/etc/s6-rc/src
+
+mkdir "${basedir}/${sv}-srv" "${basedir}/${sv}-log"
+
+(
+	cd "${basedir}/${sv}-srv"
+	echo longrun > type
+	echo "${sv}-log" > producer-for
+	cat <<-EOF > run
+	#!/bin/execlineb -P
+
+	fdmove -c 2 1
+	exec sh -c 'echo TODO >&2'
+	EOF
+)
+
+(
+	cd "${basedir}/${sv}-log"
+	echo longrun > type
+	echo 3 > notification-fd
+	echo "${sv}-srv" > consumer-for
+	echo "${sv}" > pipeline-name
+	cat <<-EOF > run
+	#!/bin/execlineb -P
+
+	envfile /etc/s6-rc/config/log.conf
+	envfile -I /etc/s6-rc/config/${sv}.conf
+	importas -sCuD "n2 s2000000 T" LOG_DIRECTIVES LOG_DIRECTIVES
+	importas -sCuD "/run/log" LOG_DIR LOG_DIR
+
+	foreground { install -d \${LOG_DIR}/${sv} }
+	s6-log -d3 -b -- \${LOG_DIRECTIVES} \${LOG_DIR}/${sv}
+	EOF
+)