]> git.netwichtig.de Git - user/henk/code/puppet/modules/s6.git/blob - files/etc/init.d/s6
fix: this is all unnecessary
[user/henk/code/puppet/modules/s6.git] / files / etc / init.d / s6
1 #!/bin/sh
2
3 ### BEGIN INIT INFO
4 # Provides:          s6
5 # Required-Start:    $remote_fs $syslog nftables
6 # Required-Stop:     $remote_fs $syslog nftables
7 # Default-Start:     2 3 4 5
8 # Default-Stop:      0 1 6
9 # Short-Description: Start s6 service supervision suite
10 # Description:       Start s6 service supervision suite
11 ### END INIT INFO
12
13 NAME="s6"
14 DESC="s6 system service supervision suite"
15 DAEMON="/usr/local/bin/s6-svscanboot"
16 SCANDIR="/etc/s6-scandir/"
17 DAEMON_ARGS=${SCANDIR}
18 SCRIPTNAME="/etc/init.d/${NAME}"
19
20 test -x $DAEMON || exit 0
21
22 if test -f /etc/default/${NAME}; then
23         . /etc/default/${NAME}
24 fi
25
26 . /lib/init/vars.sh
27 . /lib/lsb/init-functions
28
29 case "$1" in
30         start)
31                 if $0 status > /dev/null ; then
32                         log_success_msg "$NAME is already running"
33                 else
34                         log_daemon_msg "Starting ${DESC}" "${NAME}"
35                         /sbin/start-stop-daemon \
36                                 --start \
37                                 --oknodo \
38                                 --background \
39                                 --chdir "${SCANDIR}" \
40                                 --exec "${DAEMON}" \
41                                 -- "${DAEMON_ARGS}"
42                         log_end_msg $?
43                 fi
44                 ;;
45         stop)
46                 log_daemon_msg "Stopping ${DESC}" "${NAME}"
47                 /usr/bin/s6-svscanctl -t "${SCANDIR}"
48                 while $0 status
49                 do
50                         sleep 0.1
51                 done
52                 log_end_msg $?
53                 ;;
54         force-reload|restart)
55                 $0 stop
56                 $0 start
57                 ;;
58         status)
59                 /usr/bin/s6-svscanctl "${SCANDIR}"
60                 exitcode=$?
61                 case "$exitcode" in
62                         0)
63                                 log_success_msg "$NAME is running"
64                                 return ${exitcode}
65                                 ;;
66                         100)
67                                 log_failure_msg "$NAME is not running"
68                                 return ${exitcode}
69                                 ;;
70                         *)
71                                 log_failure_msg "$NAME has some problem, exit code was ${exitcode}"
72                                 return ${exitcode}
73                                 ;;
74                 esac
75                 ;;
76         *)
77                 echo "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload|status}"
78                 exit 1
79                 ;;
80 esac
81
82 exit 0