]> git.netwichtig.de Git - user/henk/code/puppet/modules/s6.git/commitdiff
fix: simplify startup script
authorHendrik Jäger <gitcommit@henk.geekmail.org>
Thu, 2 Nov 2023 12:42:27 +0000 (13:42 +0100)
committerHendrik Jäger <gitcommit@henk.geekmail.org>
Thu, 2 Nov 2023 19:48:27 +0000 (20:48 +0100)
files/etc/init.d/s6
files/usr/local/bin/s6-svscanboot

index 29bf0e2d2689d5d71370e1245fd71e3cdeba0666..f99e11db8552a8ec06f267012a8c7a7524aad9f4 100644 (file)
@@ -35,6 +35,9 @@ case "$1" in
                        /sbin/start-stop-daemon \
                                --start \
                                --oknodo \
+                               --make-pidfile \
+                               --pidfile /run/s6-svscan.pid \
+                               --background \
                                --chdir "${SCANDIR}" \
                                --exec "${DAEMON}" \
                                -- "${DAEMON_ARGS}"
@@ -48,6 +51,8 @@ case "$1" in
                        /sbin/start-stop-daemon \
                                --stop \
                                --oknodo \
+                               --remove-pidfile \
+                               --pidfile /run/s6-svscan.pid \
                                --retry TERM/60/KILL/10 \
                                --exec /usr/bin/s6-svscan
                        /sbin/start-stop-daemon \
index aca85771296a6f23fa6cff4636e2fa84d75fcd76..356b4eba44e74f15062c0ea3648437e6610a2bfc 100644 (file)
@@ -1,40 +1,9 @@
 #!/bin/execlineb -S1
 
-foreground { redirfd -w 2 /dev/null mkdir -p /run/uncaught-logs }
-if { chown s6-logs:s6-logs /run/uncaught-logs }
-if { chmod 2700 /run/uncaught-logs }
-foreground { redirfd -w 2 /dev/null mkdir -p ${1}/.s6-svscan ${1}/s6-svscan-log }
-foreground { redirfd -w 2 /dev/null ln -sf /bin/false ${1}/.s6-svscan/crash }
-if
+pipeline -w
 {
-  redirfd -w 1 ${1}/.s6-svscan/finish
-  heredoc 0 "#!/bin/execlineb -P\ns6-svc -x -- \"${1}/s6-svscan-log\"\n"
-  cat
+       /usr/bin/logger -t s6
 }
-if { chmod 0755 ${1}/.s6-svscan/finish }
-foreground { redirfd -w 2 /dev/null mkfifo -m 0600 ${1}/s6-svscan-log/fifo }
-if
-{
-  redirfd -w 1 ${1}/s6-svscan-log/run
-  heredoc 0 "#!/bin/execlineb -P
-redirfd -w 2 /dev/console
-redirfd -rnb 0 fifo
-s6-setuidgid s6-logs
-exec -c
-s6-log t T /run/uncaught-logs\n"
-  cat
-}
-if { chmod 0755 ${1}/s6-svscan-log/run }
-
-redirfd -r 0 /dev/null
-redirfd -wnb 1 ${1}/s6-svscan-log/fifo
 fdmove -c 2 1
-piperw 3 4
-background {
-       fdclose 3
-       s6-setsid
-       s6-svscan -d4 -- ${1}
-}
-fdclose 4
-fdmove 1 3
-head -n 1
+redirfd -r 0 /dev/null
+/usr/bin/s6-svscan $1