chore: restart service if it is already running and upgraded via RPM (#9970)

This commit is contained in:
Nerijus Baliūnas 2021-12-13 19:37:25 +02:00 committed by GitHub
parent 393c5e606f
commit 5cb99391b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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