#!/bin/sh ### BEGIN INIT INFO # Provides: s6 # Required-Start: $remote_fs $syslog nftables # Required-Stop: $remote_fs $syslog nftables # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start s6 service supervision suite # Description: Start s6 service supervision suite ### END INIT INFO NAME="s6" DESC="s6 system service supervision suite" DAEMON="/usr/local/bin/s6-svscanboot" SCANDIR="/etc/s6-scandir/" DAEMON_ARGS=${SCANDIR} SCRIPTNAME="/etc/init.d/${NAME}" test -x $DAEMON || exit 0 if test -f /etc/default/${NAME}; then . /etc/default/${NAME} fi . /lib/init/vars.sh . /lib/lsb/init-functions case "$1" in start) if $0 status > /dev/null ; then log_success_msg "$NAME is already running" else log_daemon_msg "Starting ${DESC}" "${NAME}" /sbin/start-stop-daemon \ --start \ --oknodo \ --make-pidfile \ --pidfile /run/s6-svscan.pid \ --background \ --chdir "${SCANDIR}" \ --exec "${DAEMON}" \ -- "${DAEMON_ARGS}" log_end_msg $? fi ;; stop) log_daemon_msg "Stopping ${DESC}" "${NAME}" /usr/bin/s6-svscanctl -t "${SCANDIR}" if test $? = 111; then /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 \ --stop \ --oknodo \ --retry TERM/60 \ --exec /usr/bin/s6-supervise fi while $0 status do sleep 0.1 done log_end_msg $? ;; force-reload|restart) $0 stop $0 start ;; status) /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}" exit 1 ;; esac exit 0