summaryrefslogtreecommitdiff
path: root/dev-db/influxdb/files/influxdb.initd-r1
blob: ef7da61d271df1c82bf1cc7fbc2686ccdfa94855 (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
46
47
#!/sbin/openrc-run

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

config_path="${config_path:-/etc/influxdb/.}"
influxd_opts=${influxd_opts:-}

command=/usr/bin/influxd
command_args="${influxd_opts}"
command_user="influxdb:influxdb"
extra_commands="version"

retry=SIGTERM/30/SIGKILL/10
supervisor="supervise-daemon"

# Max open files
rc_ulimit="-n 65536"

start_pre() {
	# Check if config file exist
	if [ -n "${config_path}" ] && [ ! -e "${config_path}" ]; then
		checkpath -d -o "${command_user}" "$(dirname "${config_path}")"
	fi
	if [ -n "${error_log}" ] && [ ! -e "${error_log}" ]; then
		checkpath -d -o "${command_user}" "$(dirname "${error_log}")"
	fi
	if [ -n "${output_log}" ] && [ ! -e "${output_log}" ]; then
		checkpath -d -o "${command_user}" "$(dirname "${output_log}")"
	fi
	return 0
}

version() {
	$command version
}

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

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