Skip to content

Commit

Permalink
Merge pull request #1620 from DataDog/quentin/run-supervisor-as-ddagent
Browse files Browse the repository at this point in the history
[core] run supervisor as dd-agent
  • Loading branch information
Remi Hakim committed Oct 1, 2015
2 parents 8acc0e8 + 6837c53 commit 0ae95f1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packaging/centos/datadog-agent.init
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ start() {
# no need to test for status before daemon,
# the daemon function does the right thing
echo -n "Starting Datadog Agent (using supervisord):"
daemon --pidfile=$SUPERVISOR_PIDFILE $SUPERVISORD_PATH -c $SUPERVISOR_CONF > /dev/null
daemon --user=$AGENTUSER --pidfile=$SUPERVISOR_PIDFILE $SUPERVISORD_PATH -c $SUPERVISOR_CONF > /dev/null
# check if the agent is running once per second for 10 seconds
retries=10
while [ $retries -gt 1 ]; do
Expand Down
4 changes: 2 additions & 2 deletions packaging/debian/datadog-agent.init
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,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 --chuid $AGENTUSER --start --quiet --oknodo --exec $SUPERVISORD_PATH -- -c $SUPERVISOR_FILE --pidfile $SUPERVISOR_PIDFILE
if [ $? -ne 0 ]; then
log_end_msg 1
fi
Expand All @@ -114,7 +114,7 @@ case "$1" in
stop)

log_daemon_msg "Stopping $DESC (stopping supervisord)" "$NAME"
start-stop-daemon --stop --retry 30 --quiet --oknodo --pidfile $SUPERVISOR_PIDFILE
start-stop-daemon --chuid $AGENTUSER --stop --retry 30 --quiet --oknodo --pidfile $SUPERVISOR_PIDFILE

log_end_msg $?

Expand Down
1 change: 1 addition & 0 deletions packaging/debian/datadog-agent.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ After=network.target

[Service]
Type=forking
User=dd-agent
ExecStart=/opt/datadog-agent/bin/start_agent.sh
ExecStop=/opt/datadog-agent/bin/supervisorctl -c /etc/dd-agent/supervisor.conf shutdown

Expand Down
2 changes: 1 addition & 1 deletion packaging/debian/start_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

PATH=/opt/datadog-agent/embedded/bin:/opt/datadog-agent/bin:$PATH

exec /opt/datadog-agent/bin/supervisord -c /etc/dd-agent/supervisor.conf --pidfile /var/run/datadog-supervisord.pid
exec /opt/datadog-agent/bin/supervisord -c /etc/dd-agent/supervisor.conf
1 change: 1 addition & 0 deletions packaging/supervisor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ logfile_maxbytes = 50MB
nodaemon = false
pidfile = /opt/datadog-agent/run/datadog-supervisord.pid
logfile_backups = 10
user=dd-agent
environment=PYTHONPATH=/opt/datadog-agent/agent:/opt/datadog-agent/agent/checks,LANG=POSIX

[program:collector]
Expand Down

0 comments on commit 0ae95f1

Please sign in to comment.