Created
June 7, 2012 17:11
-
-
Save alq666/2890110 to your computer and use it in GitHub Desktop.
Fixing datadog-agent stop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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