From 5cb99391b147b8ac7b6681af218f7b1f09f2adeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nerijus=20Bali=C5=ABnas?= Date: Mon, 13 Dec 2021 19:37:25 +0200 Subject: [PATCH] chore: restart service if it is already running and upgraded via RPM (#9970) --- scripts/rpm/post-remove.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/rpm/post-remove.sh b/scripts/rpm/post-remove.sh index 90f34f95ffd2d..08eb190d35eb7 100644 --- a/scripts/rpm/post-remove.sh +++ b/scripts/rpm/post-remove.sh @@ -28,6 +28,13 @@ if [[ -f /etc/redhat-release ]] || [[ -f /etc/SuSE-release ]]; then disable_chkconfig fi fi + if [[ $1 -ge 1 ]]; then + # Package upgrade, not uninstall + + if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then + systemctl try-restart telegraf.service >/dev/null 2>&1 || : + fi + fi elif [[ -f /etc/os-release ]]; then source /etc/os-release if [[ "$ID" = "amzn" ]] && [[ "$1" = "0" ]]; then