Skip to content

Instantly share code, notes, and snippets.

@alq666
Created June 7, 2012 17:11
Show Gist options
  • Save alq666/2890110 to your computer and use it in GitHub Desktop.
Save alq666/2890110 to your computer and use it in GitHub Desktop.
Fixing datadog-agent stop
diff --git a/packaging/datadog-agent-base/deb/datadog-agent.init b/packaging/datadog-agent-base/deb/datadog-agent.init
index 7dc0fa0..74c3e8e 100755
--- a/packaging/datadog-agent-base/deb/datadog-agent.init
+++ b/packaging/datadog-agent-base/deb/datadog-agent.init
@@ -54,8 +54,15 @@ case "$1" in
echo -n "Stopping $DESC: "
if [ -f $USE_SUPERVISOR ]; then
- echo -n "(using supervisorctl) "
- supervisorctl stop datadog-agent:*
+ # Prevent errors if not under actual supervision
+ supervised=$(supervisorctl avail | grep datadog-agent | wc -l)
+ if [ $supervised -gt 1 ]; then
+ echo -n "(using supervisorctl) "
+ supervisorctl stop datadog-agent:*
+ else
+ # Should have been
+ echo -n "(warning: datadog-agent supervisor config is missing) "
+ fi
else
su $AGENTUSER -c "$AGENTPATH stop init"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment