]> git.netwichtig.de Git - user/henk/code/puppet/modules/s6.git/blob - files/etc/init.d/s6
change scandir path
[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 PIDFILE="/var/run/s6.pid"
19 SCRIPTNAME="/etc/init.d/${NAME}"
20
21 test -x $DAEMON || exit 0
22
23 if test -f /etc/default/${NAME}; then
24         . /etc/default/${NAME}
25 fi
26
27 . /lib/init/vars.sh
28 . /lib/lsb/init-functions
29
30 case "$1" in
31         start)
32                 if $0 status > /dev/null ; then
33                         log_success_msg "$NAME is already running"
34                 else
35                         log_daemon_msg "Starting ${DESC}" "${NAME}"
36                         /sbin/start-stop-daemon \
37                                 --start \
38                                 --oknodo \
39                                 --chdir "${SCANDIR}" \
40                                 --startas "${DAEMON}" \
41                                 --background \
42                                 --make-pidfile \
43                                 --pidfile "${PIDFILE}" \
44                                 -- "${DAEMON_ARGS}"
45                         log_end_msg $?
46                 fi
47                 ;;
48         stop)
49                 log_daemon_msg "Stopping ${DESC}" "${NAME}"
50                 /sbin/start-stop-daemon \
51                         --stop \
52                         --oknodo \
53                         --retry TERM/60/QUIT/60 \
54                         --remove-pidfile \
55                         --pidfile "${PIDFILE}"
56                 if test $? = 2; then
57                         /sbin/start-stop-daemon \
58                                 --stop \
59                                 --oknodo \
60                                 --retry TERM/60/KILL/10 \
61                                 --exec /usr/bin/s6-svscan
62                         /sbin/start-stop-daemon \
63                                 --stop \
64                                 --oknodo \
65                                 --retry TERM/60 \
66                                 --exec /usr/bin/s6-supervise
67                 fi
68                 log_end_msg $?
69                 ;;
70         force-reload|restart)
71                 $0 stop
72                 $0 start
73                 ;;
74         status)
75                 status_of_proc -p ${PIDFILE} ${DAEMON} s6 && exit 0 || exit $?
76                 ;;
77         *)
78                 echo "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload|status}"
79                 exit 1
80                 ;;
81 esac
82
83 exit 0