#!/sbin/runscript

# This program is Copyright (c) SolarWinds Worldwide, LLC. All rights reserved.

command="/usr/local/bin/vividcortex/vc-agent-007"
pidpath="/var/run/vividcortex"
pidfile="${pidpath}/vc-agent-007.pid"
rc_cgroup_cleanup="yes"
command_args=""
if [ "$RC_CMD" = "start" -a ! "$RC_PID" = "" ]; then
	# Booting.  Allow for up to 10 retries for network to be fully functional, with 10 seconds between them.
	command_args="-startup-network-retries=10 -startup-network-retry-interval=10s"
fi
set_conf_file=0
if [ "${set_conf_file}" != "0" ]; then
	command_args="${command_args} -config-file=/etc/vividcortex/global.conf"
fi
DAEMON_USER=""

# Set HOME in case it isn't defined or points to a user dir (sudo)
test "${DAEMON_USER}" = "" && HOME=~root
test "${DAEMON_USER}" = "" || HOME="/home/${DAEMON_USER}"
test -d "${HOME}" || HOME=/root
test -d "${HOME}" || HOME=
export HOME

mkdir -p "${pidpath}"
test "${DAEMON_USER}" = "" || chown -R "${DAEMON_USER}:${DAEMON_USER}" "${pidpath}"

depend() {
	need localmount
	use logger net dns
	after bootmisc clock
	provide vividcortex
}
