]> git.netwichtig.de Git - user/henk/code/puppet/modules/s6.git/commitdiff
fix: wait until s6-svscan is ready
authorHendrik Jäger <gitcommit@henk.geekmail.org>
Sun, 22 May 2022 13:36:47 +0000 (15:36 +0200)
committerHendrik Jäger <gitcommit@henk.geekmail.org>
Mon, 25 Jul 2022 21:53:04 +0000 (23:53 +0200)
files/etc/init.d/s6
files/usr/local/bin/s6-svscanboot
files/usr/local/bin/s6-svscanboot.buster

index a30790887b7c2be042331722e35bb03d3c5822d3..371e53ef313f488b2bc9c36ca0c7803625690cac 100644 (file)
@@ -15,7 +15,6 @@ DESC="s6 system service supervision suite"
 DAEMON="/usr/local/bin/s6-svscanboot"
 SCANDIR="/etc/s6-scandir/"
 DAEMON_ARGS=${SCANDIR}
-PIDFILE="/var/run/s6.pid"
 SCRIPTNAME="/etc/init.d/${NAME}"
 
 test -x $DAEMON || exit 0
@@ -37,23 +36,15 @@ case "$1" in
                                --start \
                                --oknodo \
                                --chdir "${SCANDIR}" \
-                               --startas "${DAEMON}" \
-                               --background \
-                               --make-pidfile \
-                               --pidfile "${PIDFILE}" \
+                               --exec "${DAEMON}" \
                                -- "${DAEMON_ARGS}"
                        log_end_msg $?
                fi
                ;;
        stop)
                log_daemon_msg "Stopping ${DESC}" "${NAME}"
-               /sbin/start-stop-daemon \
-                       --stop \
-                       --oknodo \
-                       --retry TERM/60/QUIT/60 \
-                       --remove-pidfile \
-                       --pidfile "${PIDFILE}"
-               if test $? = 2; then
+               /usr/bin/s6-svscanctl -t "${SCANDIR}"
+               if test $? = 111; then
                        /sbin/start-stop-daemon \
                                --stop \
                                --oknodo \
@@ -72,7 +63,7 @@ case "$1" in
                $0 start
                ;;
        status)
-               status_of_proc -p ${PIDFILE} ${DAEMON} s6 && exit 0 || exit $?
+               status_of_proc ${DAEMON} s6 && exit 0 || exit $?
                ;;
        *)
                echo "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload|status}"
index 7a5f549023e27d128c8878d8826749558aeec54c..f2b6e35931797e96a485ce41c83d85c780e574bc 100644 (file)
@@ -29,5 +29,12 @@ 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
-s6-svscan -- ${1}
-
+piperw 3 4
+background {
+       fdclose 3
+       s6-setsid
+       s6-svscan -d4 -- ${1}
+}
+fdclose 4
+fdmove 1 3
+head -n 1
index ef6de1b3ec9fb07c57ee6393253d4e8e248a4d96..28aa5a1966dcc37e4dc0a9977236613a7045f7e5 100644 (file)
@@ -29,5 +29,12 @@ 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
-s6-svscan -- ${1}
-
+piperw 3 4
+background {
+       fdclose 3
+       s6-setsid
+       s6-svscan -d4 -- ${1}
+}
+fdclose 4
+fdmove 1 3
+head -n 1