mirror of
https://git.freebsd.org/ports.git
synced 2025-06-26 23:20:30 -04:00
63 lines
1.6 KiB
Bash
63 lines
1.6 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: datadog_process_agent
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# datadog_process_agent_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable Datadog Process Agent.
|
|
# datadog_process_agent_user (user): Set user to run Datadog Process Agent.
|
|
# Default is "%%USER%%".
|
|
# datadog_process_agent_conf (path): Path to Datadog Process Agent configuration file.
|
|
# Default is %%ETCDIR%%/datadog.yaml
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=datadog_process_agent
|
|
rcvar=datadog_process_agent_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${datadog_process_agent_enable:="NO"}
|
|
: ${datadog_process_agent_user="%%USER%%"}
|
|
: ${datadog_process_agent_conf:="%%ETCDIR%%/datadog.yaml"}
|
|
|
|
command="%%DATADOG_PREFIX%%/process-agent"
|
|
command_args="-config ${datadog_process_agent_conf}"
|
|
|
|
required_files=%%ETCDIR%%/datadog.yaml
|
|
pidfile="%%RUNDIR%%/datadog-agent-process.pid"
|
|
|
|
start_cmd="${name}_start start $@"
|
|
stop_cmd="${name}_stop stop $@"
|
|
status_cmd="${name}_status"
|
|
|
|
datadog_process_agent_status()
|
|
{
|
|
rc_pid=`check_pidfile ${pidfile} ${command}`
|
|
if [ -n "${rc_pid}" ]; then
|
|
echo "Datadog process agent is running as pid ${rc_pid}."
|
|
else
|
|
echo "Datadog process agent is not running."
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
datadog_process_agent_start() {
|
|
/usr/sbin/daemon -f -p ${pidfile} -u ${datadog_process_agent_user} ${command} ${command_args}
|
|
return $?
|
|
}
|
|
|
|
datadog_process_agent_stop() {
|
|
rc_pid=`check_pidfile ${pidfile} ${command}`
|
|
if [ -n "${rc_pid}" ]; then
|
|
kill ${rc_pid}
|
|
else
|
|
echo "Datadog process agent is not running."
|
|
fi
|
|
}
|
|
|
|
run_rc_command "$@"
|