fix systemd path in order to add compatibility with SuSe (#2499)
This commit is contained in:
parent
e2983383e4
commit
a8cfe03ba8
|
@ -11,7 +11,7 @@ function install_init {
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_systemd {
|
function install_systemd {
|
||||||
cp -f $SCRIPT_DIR/telegraf.service /lib/systemd/system/telegraf.service
|
cp -f $SCRIPT_DIR/telegraf.service $1
|
||||||
systemctl enable telegraf || true
|
systemctl enable telegraf || true
|
||||||
systemctl daemon-reload || true
|
systemctl daemon-reload || true
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ if [[ ! -d /etc/telegraf/telegraf.d ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Distribution-specific logic
|
# Distribution-specific logic
|
||||||
if [[ -f /etc/redhat-release ]]; then
|
if [[ -f /etc/redhat-release ]] || [[ -f /etc/SuSE-release ]]; then
|
||||||
# RHEL-variant logic
|
# RHEL-variant logic
|
||||||
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
||||||
install_systemd
|
install_systemd /usr/lib/systemd/system/telegraf.service
|
||||||
else
|
else
|
||||||
# Assuming SysVinit
|
# Assuming SysVinit
|
||||||
install_init
|
install_init
|
||||||
|
@ -73,7 +73,7 @@ if [[ -f /etc/redhat-release ]]; then
|
||||||
elif [[ -f /etc/debian_version ]]; then
|
elif [[ -f /etc/debian_version ]]; then
|
||||||
# Debian/Ubuntu logic
|
# Debian/Ubuntu logic
|
||||||
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
||||||
install_systemd
|
install_systemd /lib/systemd/system/telegraf.service
|
||||||
systemctl restart telegraf || echo "WARNING: systemd not running."
|
systemctl restart telegraf || echo "WARNING: systemd not running."
|
||||||
else
|
else
|
||||||
# Assuming SysVinit
|
# Assuming SysVinit
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
function disable_systemd {
|
function disable_systemd {
|
||||||
systemctl disable telegraf
|
systemctl disable telegraf
|
||||||
rm -f /lib/systemd/system/telegraf.service
|
rm -f $1
|
||||||
}
|
}
|
||||||
|
|
||||||
function disable_update_rcd {
|
function disable_update_rcd {
|
||||||
|
@ -15,14 +15,14 @@ function disable_chkconfig {
|
||||||
rm -f /etc/init.d/telegraf
|
rm -f /etc/init.d/telegraf
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -f /etc/redhat-release ]]; then
|
if [[ -f /etc/redhat-release ]] || [[ -f /etc/SuSE-release ]]; then
|
||||||
# RHEL-variant logic
|
# RHEL-variant logic
|
||||||
if [[ "$1" = "0" ]]; then
|
if [[ "$1" = "0" ]]; then
|
||||||
# InfluxDB is no longer installed, remove from init system
|
# InfluxDB is no longer installed, remove from init system
|
||||||
rm -f /etc/default/telegraf
|
rm -f /etc/default/telegraf
|
||||||
|
|
||||||
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
||||||
disable_systemd
|
disable_systemd /usr/lib/systemd/system/telegraf.service
|
||||||
else
|
else
|
||||||
# Assuming sysv
|
# Assuming sysv
|
||||||
disable_chkconfig
|
disable_chkconfig
|
||||||
|
@ -35,7 +35,7 @@ elif [[ -f /etc/debian_version ]]; then
|
||||||
rm -f /etc/default/telegraf
|
rm -f /etc/default/telegraf
|
||||||
|
|
||||||
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
||||||
disable_systemd
|
disable_systemd /lib/systemd/system/telegraf.service
|
||||||
else
|
else
|
||||||
# Assuming sysv
|
# Assuming sysv
|
||||||
# Run update-rc.d or fallback to chkconfig if not available
|
# Run update-rc.d or fallback to chkconfig if not available
|
||||||
|
|
Loading…
Reference in New Issue