From 4f9106ff3c6a1d1e3f04df33b6b8db6a3c6152f3 Mon Sep 17 00:00:00 2001 From: Jaime Fullaondo Date: Tue, 21 Feb 2017 13:30:35 -0500 Subject: [PATCH] [packaging] implement condrestart. --- packaging/centos/datadog-agent.init | 10 ++++++++++ packaging/debian/datadog-agent.init | 8 ++++++++ 2 files changed, 18 insertions(+) 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 $?