github.com/influxdata/telegraf@v1.30.3/scripts/deb/post-remove.sh (about) 1 #!/bin/bash 2 3 function disable_systemd { 4 systemctl disable telegraf 5 rm -f $1 6 } 7 8 function disable_update_rcd { 9 update-rc.d -f telegraf remove 10 rm -f /etc/init.d/telegraf 11 } 12 13 function disable_chkconfig { 14 chkconfig --del telegraf 15 rm -f /etc/init.d/telegraf 16 } 17 18 if [ "$1" == "remove" -o "$1" == "purge" ]; then 19 # Remove/purge 20 rm -f /etc/default/telegraf 21 22 if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then 23 disable_systemd /lib/systemd/system/telegraf.service 24 else 25 # Assuming sysv 26 # Run update-rc.d or fallback to chkconfig if not available 27 if which update-rc.d &>/dev/null; then 28 disable_update_rcd 29 else 30 disable_chkconfig 31 fi 32 fi 33 fi