From 8828728f2db39e1e333e487d6e21dac84485b535 Mon Sep 17 00:00:00 2001 From: Jaime Fullaondo Date: Thu, 24 Aug 2017 20:38:54 +0200 Subject: [PATCH] [systemd] apply sysconfig/default settings on launch too. (#3489) --- packaging/datadog-agent.service | 2 ++ packaging/start_agent.sh | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/packaging/datadog-agent.service b/packaging/datadog-agent.service index debb14bfd9..e8e22f25ee 100644 --- a/packaging/datadog-agent.service +++ b/packaging/datadog-agent.service @@ -5,6 +5,8 @@ After=network.target [Service] Type=forking User=dd-agent +EnvironmentFile=-/etc/default/datadog-agent +EnvironmentFile=-/etc/sysconfig/datadog-agent ExecStart=/opt/datadog-agent/bin/start_agent.sh ExecStop=/opt/datadog-agent/bin/supervisorctl -c /etc/dd-agent/supervisor.conf shutdown diff --git a/packaging/start_agent.sh b/packaging/start_agent.sh index fddb6c4249..949ddce68f 100644 --- a/packaging/start_agent.sh +++ b/packaging/start_agent.sh @@ -5,4 +5,9 @@ PATH=/opt/datadog-agent/embedded/bin:/opt/datadog-agent/bin:$PATH +if [ "$DATADOG_ENABLED" = "no" ]; then + echo "Disabled via DATADOG_ENABLED env var. Exiting." + exit 0 +fi + exec /opt/datadog-agent/bin/supervisord -c /etc/dd-agent/supervisor.conf