diff --git a/packaging/centos/datadog-agent.init b/packaging/centos/datadog-agent.init index a2acebd45e..26f716fb28 100644 --- a/packaging/centos/datadog-agent.init +++ b/packaging/centos/datadog-agent.init @@ -177,6 +177,12 @@ restart() { start } +condrestart() { + if [ -f "$LOCKFILE" ]; then + restart + fi +} + info() { shift # Shift 'info' out of the args so we can pass any # additional options to the real command @@ -216,6 +222,10 @@ case "$1" in restart ;; + condrestart|try-reload) + condrestart + ;; + status) # Note: sh does not support arrays # Check for kernel version 3.18+ - overlayfs has known bug affecting unix domain sockets diff --git a/packaging/debian/datadog-agent.init b/packaging/debian/datadog-agent.init index 002ac40f32..c103874653 100755 --- a/packaging/debian/datadog-agent.init +++ b/packaging/debian/datadog-agent.init @@ -213,6 +213,14 @@ case "$1" in $0 start ;; + condrestart|try-reload) + check_status essential > /dev/null + if [ $? -eq 0 ]; then + $0 stop + $0 start + fi + ;; + configcheck) su $AGENTUSER -c "$AGENTPATH configcheck" exit $?