summaryrefslogtreecommitdiff
blob: 00e3c25ebe84b4234ab914da7a885d8175dab3cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/sbin/openrc-run
# Copyright 2016-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

description="Prometheus monitoring system and time series database"
pidfile=/var/run/${RC_SVCNAME}.pid
user=${user:-${RC_SVCNAME}}
group=${group:-${RC_SVCNAME}}
command_user=${user}:${group}

command="/usr/bin/prometheus"
if [ -z "${command_args}" ]; then
command_args="
	--web.enable-lifecycle
	--config.file=/etc/prometheus/prometheus.yml
	--storage.tsdb.path=/var/lib/prometheus/data
	--web.console.templates=/etc/prometheus/consoles
	--web.console.libraries=/etc/prometheus/console_libraries
	--web.enable-admin-api 
	${prometheus_args}"
else
command_args="${command_args:---config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data}"
fi
command_background="true"
error_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
output_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log

extra_started_commands="reload"

depend() {
	after net
}

reload() {
	ebegin "Reloading configuration for ${RC_SVCNAME}"
	case "$supervisor" in
		supervise-daemon)
		supervise-daemon ${RC_SVCNAME} --signal HUP
		;;
		*)
		start-stop-daemon --signal HUP --pidfile "${pidfile}"
		;;
	esac
	eend $? "Failed to reload ${RC_SVCNAME}"
}