github.com/craicoverflow/tyk@v2.9.6-rc3+incompatible/install/post_remove.sh (about)

     1  #!/bin/bash
     2  echo "Removing init scripts..."
     3  
     4  SYSTEMD="/lib/systemd/system"
     5  UPSTART="/etc/init"
     6  SYSV1="/etc/init.d"
     7  SYSV2="/etc/rc.d/init.d/"
     8  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
     9  
    10  if [ -f "/lib/systemd/system/tyk-gateway.service" ]; then
    11  	echo "Found Systemd"
    12  	echo "Stopping the service"
    13  	systemctl stop tyk-gateway.service
    14          # Removed lua and python in 2.9, keeping so upgrades work
    15          # and for compatibility.
    16  	systemctl stop tyk-gateway-python.service || true
    17  	systemctl stop tyk-gateway-lua.service || true
    18  	echo "Removing the service"
    19  	rm -f /lib/systemd/system/tyk-gateway.service
    20  	rm -f /lib/systemd/system/tyk-gateway-python.service
    21  	rm -f /lib/systemd/system/tyk-gateway-lua.service
    22  	systemctl --system daemon-reload
    23  fi
    24  
    25  if [ -f "/etc/init/tyk-gateway.conf" ]; then
    26  	echo "Found upstart"
    27  	echo "Stopping the service"
    28  	stop tyk-gateway
    29  	stop tyk-gateway-python || true
    30  	stop tyk-gateway-lua || true
    31  	echo "Removing the service"
    32  	rm -f /etc/init/tyk-gateway.conf
    33  	rm -f /etc/init/tyk-gateway-python.conf
    34  	rm -f /etc/init/tyk-gateway-lua.conf
    35  fi
    36  
    37  if [ -f "/etc/init.d/tyk-gateway" ]; then
    38  	echo "Found Sysv1"
    39  	/etc/init.d/tyk-gateway stop
    40  	/etc/init.d/tyk-gateway-python stop || true
    41  	/etc/init.d/tyk-gateway-lua stop || true
    42  	rm -f /etc/init.d/tyk-gateway
    43  	rm -f /etc/init.d/tyk-gateway-python
    44  	rm -f /etc/init.d/tyk-gateway-lua
    45  fi
    46  
    47  if [ -f "/etc/rc.d/init.d/tyk-gateway" ]; then
    48  	echo "Found Sysv2"
    49  	echo "Stopping the service"
    50  	/etc/rc.d/init.d/tyk-gateway stop
    51  	/etc/rc.d/init.d/tyk-gateway-python stop || true
    52  	/etc/rc.d/init.d/tyk-gateway-lua stop || true
    53  	echo "Removing the service"
    54  	rm -f /etc/rc.d/init.d/tyk-gateway
    55  	rm -f /etc/rc.d/init.d/tyk-gateway-python
    56  	rm -f /etc/rc.d/init.d/tyk-gateway-lua
    57  fi