2016-02-24 01:25:07 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2022-08-23 02:57:38 +08:00
|
|
|
# Telegraf is no longer installed, remove from systemd
|
|
|
|
|
if [[ "$1" = "0" ]]; then
|
|
|
|
|
rm -f /etc/default/telegraf
|
2016-02-24 01:25:07 +08:00
|
|
|
|
2022-08-23 02:57:38 +08:00
|
|
|
if [[ -d /run/systemd/system ]]; then
|
|
|
|
|
systemctl disable telegraf
|
|
|
|
|
rm -f /usr/lib/systemd/system/telegraf.service
|
|
|
|
|
systemctl daemon-reload
|
2016-02-24 01:25:07 +08:00
|
|
|
fi
|
2022-08-23 02:57:38 +08:00
|
|
|
fi
|
2019-02-07 08:17:11 +08:00
|
|
|
|
2022-08-23 02:57:38 +08:00
|
|
|
# Telegraf upgrade, restart service
|
|
|
|
|
if [[ $1 -ge 1 ]]; then
|
|
|
|
|
if [[ -d /run/systemd/system ]]; then
|
|
|
|
|
systemctl try-restart telegraf.service >/dev/null 2>&1 || :
|
2016-02-24 01:25:07 +08:00
|
|
|
fi
|
|
|
|
|
fi
|