Debian Codegraph @

debian/prometheus-redis-exporter.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: prometheus-redis-exporter
8 # Required-Start: $remote_fs
9 # Required-Stop: $remote_fs
10 # Should-Start: redis-server
11 # Should-Stop: redis-server
12 # Default-Start: 2 3 4 5
13 # Default-Stop: 0 1 6
14 # Short-Description: Prometheus exporter for Valkey metrics (Redis compatible)
15 # Description: Prometheus exporter for Valkey metrics (Redis compatible)
16 ### END INIT INFO
17
18 # Author: Martina Ferrari <[email protected]>
19 # Author: Guillem Jover <[email protected]>
20
21 DESC="Prometheus exporter for Valkey metrics (Redis compatible)"
22 NAME=prometheus-redis-exporter
23 USER=prometheus
24 GROUP=$USER
25 DAEMON=/usr/bin/$NAME
26 PIDFILE=/run/prometheus/$NAME.pid
27 LOGFILE=/var/log/prometheus/$NAME.log
28
29 START_ARGS="--no-close --background --make-pidfile"
30 STOP_ARGS="--remove-pidfile"
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 {
46 start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 \
47 --exec $DAEMON --pidfile $PIDFILE --user $USER $STOP_ARGS
48 }
49
50 alias do_reload=do_reload_sigusr1