@@ -12,7 +12,7 @@ function install_init {
|
||||
|
||||
function install_systemd {
|
||||
cp -f $SCRIPT_DIR/telegraf.service /lib/systemd/system/telegraf.service
|
||||
systemctl enable telegraf
|
||||
systemctl enable telegraf || true
|
||||
systemctl daemon-reload || true
|
||||
}
|
||||
|
||||
@@ -53,29 +53,29 @@ if [[ -f /etc/redhat-release ]]; then
|
||||
# RHEL-variant logic
|
||||
which systemctl &>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
install_systemd
|
||||
install_systemd
|
||||
else
|
||||
# Assuming sysv
|
||||
install_init
|
||||
install_chkconfig
|
||||
# Assuming sysv
|
||||
install_init
|
||||
install_chkconfig
|
||||
fi
|
||||
elif [[ -f /etc/debian_version ]]; then
|
||||
# Debian/Ubuntu logic
|
||||
which systemctl &>/dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
install_systemd
|
||||
systemctl restart telegraf
|
||||
install_systemd
|
||||
systemctl restart telegraf || echo "WARNING: systemd not running."
|
||||
else
|
||||
# Assuming sysv
|
||||
install_init
|
||||
install_update_rcd
|
||||
invoke-rc.d telegraf restart
|
||||
# Assuming sysv
|
||||
install_init
|
||||
install_update_rcd
|
||||
invoke-rc.d telegraf restart
|
||||
fi
|
||||
elif [[ -f /etc/os-release ]]; then
|
||||
source /etc/os-release
|
||||
if [[ $ID = "amzn" ]]; then
|
||||
# Amazon Linux logic
|
||||
install_init
|
||||
install_chkconfig
|
||||
# Amazon Linux logic
|
||||
install_init
|
||||
install_chkconfig
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user