Debian Codegraph @

debian/init

raw
1 #!/bin/sh
2 # kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
3 if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
4 set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
5 fi
6 ### BEGIN INIT INFO
7 # Provides: alertmanager-irc-relay
8 # Required-Start: $remote_fs
9 # Required-Stop: $remote_fs
10 # Default-Start: 2 3 4 5
11 # Default-Stop: 0 1 6
12 # Short-Description: Prometheus alertmanager to IRC bridge
13 ### END INIT INFO
14
15 # Author: Filippo Giunchedi <[email protected]>
16 # Author: Martina Ferrari <[email protected]>
17 # Author: Guillem Jover <[email protected]>
18
19 DESC="Prometheus alertmanager to IRC bridge"
20 NAME=alertmanager-irc-relay
21 USER=$NAME
22 GROUP=$NAME
23 DAEMON=/usr/bin/$NAME
24 PIDFILE=/run/$NAME/$NAME.pid
25 LOGFILE=/var/log/prometheus/$NAME.log
26
27 START_ARGS="--no-close --background --make-pidfile"
28 STOP_ARGS="--remove-pidfile"
29
30 : ${ARGS:=}
31
32 do_start_prepare()
33 {
34 mkdir -p $(dirname $PIDFILE)
35 }
36
37 do_start_cmd_override()
38 {
39 start-stop-daemon --start --quiet --oknodo \
40 --exec $DAEMON --pidfile $PIDFILE --user $USER --group $GROUP \
41 --chuid $USER:$GROUP $START_ARGS -- $ARGS >>$LOGFILE 2>&1
42 }
43
44 do_stop_cmd_override() {
45 start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 \
46 --exec $DAEMON --pidfile $PIDFILE --user $USER $STOP_ARGS
47 }