summaryrefslogtreecommitdiff
blob: 28fd9f6861c06eeeb3de24fbaa376b37ddc3a788 (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
#!/sbin/openrc-run

config="${config:-/etc/influxdb/influxdb.conf}"

supervisor="supervise-daemon"
command=/usr/bin/influxd
command_args="-config ${config} -pidfile ${pidfile} ${influxd_opts}"
command_user="influxdb:influxdb"

retry=SIGTERM/30/SIGKILL/10
wait=1000

# Logging
error_log="${error_log:-/var/log/influxdb/influxd.log}"
output_log="${output_log:-/dev/null}"

# Max open files
rc_ulimit="-n 65536"

start_pre() {
	# Check if config file exist
	if [ ! -r ${config} ]; then
		eerror "config file ${config} doesn't exist"
	    return 1
	fi
	if [ ! -f "$error_log" ]; then
		mkdir -p "$(dirname $error_log)"
	fi
	if [ ! -f "$output_log" ]; then
		mkdir -p "$(dirname $output_log)"
	fi
	return 0
}

if [[ -n "${INFLUXDB_HEALTHCHECK_URI}" ]]; then
        healthcheck_delay=300
        healthcheck_timer=60

        healthcheck() {
                command -v wget || return 0
                wget -Oq- "${INFLUXDB_HEALTHCHECK_URI}"
        }
fi