Debian Codegraph @

debian/init

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
3 if [scip-shell system . . `[`. true != "$INIT_D_SCRIPT_SOURCED" ] ; then
4 set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-scriptscip-shell source . . `/lib/init/init-d-script`.
5 fi
6 ### BEGIN INIT INFO
7 # Provides: prometheus-libvirt-exporter
8 # Required-Start: $remote_fs $syslog
9 # Required-Stop: $remote_fs $syslog
10 # Default-Start: 2 3 4 5
11 # Default-Stop: 0 1 6
12 # Short-Description: Prometheus exporter for libvirt metrics
13 # Description: Prometheus exporter for libvirt metrics, written in Go
14 ### END INIT INFO
15
16 # Author: Michal Arbet <[email protected]>
17
18 DESC="Prometheus exporter for libvirt metrics"
19 DAEMON=/usr/bin/prometheus-libvirt-exporterscip-shell filesystem . . `/usr/bin/prometheus-libvirt-exporter`.
20 NAME=prometheus-libvirt-exporter
21 USER=prometheus
22 PIDFILE=/var/run/prometheus/prometheus-libvirt-exporter.pidscip-shell filesystem . . `/var/run/prometheus/prometheus-libvirt-exporter.pid`.
23
24 ARGS=""
25 [scip-shell system . . `[`. -r /etc/default/$NAME ] && . /etc/default/$NAME
26
27 HELPER=/usr/bin/daemonscip-shell filesystem . . `/usr/bin/daemon`.
28 HELPER_ARGS="--name=$NAME --pidfile=$PIDFILE --user=$USER"
29
30 do_start_preparescip-shell shell shell-project 0.0.0 do_start_prepare().()
31 {
32 mkdirscip-shell system . . mkdir. -p `dirnamescip-shell system . . dirname. $PIDFILE` || truescip-shell system . . true.
33 chownscip-shell system . . chown. -R $USER: `dirnamescip-shell system . . dirname. $PIDFILE`
34 }
35
36 do_start_cmdscip-shell shell shell-project 0.0.0 do_start_cmd().()
37 {
38 # Return
39 # 0 if daemon has been started
40 # 1 if daemon was already running
41 # 2 if daemon could not be started
42 $HELPER $HELPER_ARGS --running && return 1
43 $HELPER $HELPER_ARGS -- $DAEMON $ARGS || return 2
44 return 0
45 }
46
47 do_stop_cmdscip-shell shell shell-project 0.0.0 do_stop_cmd().()
48 {
49 # Return
50 # 0 if daemon has been stopped
51 # 1 if daemon was already stopped
52 # 2 if daemon could not be stopped
53 # other if a failure occurred
54 $HELPER $HELPER_ARGS --running || return 1
55 $HELPER $HELPER_ARGS --stop || return 2
56 # wait for the process to really terminate
57 for n in 1 2 3 4 5; do
58 sleepscip-shell system . . sleep. 1
59 $HELPER $HELPER_ARGS --running || break
60 done
61 $HELPER $HELPER_ARGS --running || return 0
62 return 2
63 }