]> git.netwichtig.de Git - user/henk/code/puppet/modules/s6.git/blobdiff - files/etc/init.d/s6
fix: status command in init-script was broken
[user/henk/code/puppet/modules/s6.git] / files / etc / init.d / s6
index ef577a06572953707f9b79c9839e630035f7bbb2..29bf0e2d2689d5d71370e1245fd71e3cdeba0666 100644 (file)
@@ -13,9 +13,8 @@
 NAME="s6"
 DESC="s6 system service supervision suite"
 DAEMON="/usr/local/bin/s6-svscanboot"
-SCANDIR="/etc/s6-services/"
+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,22 @@ case "$1" in
                $0 start
                ;;
        status)
-               status_of_proc -p ${PIDFILE} ${DAEMON} s6 && exit 0 || exit $?
+               /usr/bin/s6-svscanctl "${SCANDIR}"
+               exitcode=$?
+               case "$exitcode" in
+                       0)
+                               log_success_msg "$NAME is running"
+                               return ${exitcode}
+                               ;;
+                       100)
+                               log_failure_msg "$NAME is not running"
+                               return ${exitcode}
+                               ;;
+                       *)
+                               log_failure_msg "$NAME has some problem, exit code was ${exitcode}"
+                               return ${exitcode}
+                               ;;
+               esac
                ;;
        *)
                echo "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload|status}"