Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in support for /etc/default/datadog-agent and set nicelevel from it #3086

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packaging/centos/datadog-agent.init
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ DD_OPT_PROC_REGEX="dogstatsd|jmxfetch|go-metro"
# Source function library.
. /etc/rc.d/init.d/functions

[ -r /etc/sysconfig/datadog-agent ] && . /etc/sysconfig/datadog-agent

check_status() {
# run checks to determine if the service is running or use generic status
Expand Down Expand Up @@ -136,6 +137,10 @@ start() {
echo -n $'\n'"Resuming starting process."$'\n'
fi

# NICELEVEL, if set, comes from /etc/default/datadog-agent.
# daemon will honor it, so we should export it.
export NICELEVEL

# no need to test for status before daemon,
# the daemon function does the right thing
echo -n "Starting Datadog Agent (using supervisord):"
Expand Down
4 changes: 3 additions & 1 deletion packaging/debian/datadog-agent.init
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ COLLECTOR_PIDFILE="/opt/datadog-agent/run/dd-agent.pid"
SYSTEM_PATH=/opt/datadog-agent/embedded/bin:/opt/datadog-agent/bin:$PATH
DD_OPT_PROC_REGEX="dogstatsd|jmxfetch|go-metro"

[ -r /etc/default/datadog-agent ] && . /etc/default/datadog-agent

if [ ! -x $AGENTPATH ]; then
echo "$AGENTPATH not found. Exiting."
exit 0
Expand Down Expand Up @@ -133,7 +135,7 @@ case "$1" in


log_daemon_msg "Starting $DESC (using supervisord)" "$NAME"
PATH=$SYSTEM_PATH start-stop-daemon --start --quiet --oknodo --exec $SUPERVISORD_PATH -- -c $SUPERVISOR_FILE --pidfile $SUPERVISOR_PIDFILE
PATH=$SYSTEM_PATH start-stop-daemon --start ${NICELEVEL:+"--nicelevel $NICELEVEL"} --quiet --oknodo --exec $SUPERVISORD_PATH -- -c $SUPERVISOR_FILE --pidfile $SUPERVISOR_PIDFILE
if [ $? -ne 0 ]; then
log_end_msg 1
fi
Expand Down