#!/sbin/openrc-run

COLLECTD_USER=${COLLECTD_USER:-"collectd"}
COLLECTD_GROUP=${COLLECTD_GROUP:-"collectd"}
COLLECTD_ARGS=${COLLECTD_ARGS:-""}
COLLECTD_PIDFILE=${COLLECTD_PIDFILE:-"/run/collectd/collectd.pid"}

command=/usr/sbin/collectd
pidfile="$COLLECTD_PIDFILE"
command_args="${COLLECTD_ARGS} -P $pidfile"
start_stop_daemon_args="--user ${COLLECTD_USER}:${COLLECTD_GROUP}"
retry=${COLLECTD_TERMTIMEOUT:-"TERM/25/KILL/5"}

start_pre() {
	checkpath --directory --owner "$COLLECTD_USER":"$COLLECTD_GROUP" \
		--mode 0770 "$(dirname $pidfile)" /var/lib/collectd
}
