fix: cleaner nginx removal process

This commit is contained in:
th33xitus
2020-09-11 10:25:38 +02:00
parent c98584dde8
commit 83e9618a75

View File

@@ -173,16 +173,14 @@ remove_octoprint(){
remove_nginx(){ remove_nginx(){
if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then if [[ $(dpkg-query -f'${Status}' --show nginx 2>/dev/null) = *\ installed ]] ; then
status_msg "Stopping and removing Nginx Service ..." if systemctl is-active nginx -q; then
if [ -e /etc/init.d/nginx ]; then status_msg "Stopping Nginx service ..."
sudo /etc/init.d/nginx stop && ok_msg "Nginx Service stopped!" sudo service nginx stop && sudo systemctl disable nginx
sudo rm /etc/init.d/nginx && ok_msg "Nginx Service removed!" ok_msg "Service stopped!"
fi
if [ -e /etc/default/nginx ]; then
sudo rm /etc/default/nginx
fi fi
status_msg "Purging Nginx from system ..." status_msg "Purging Nginx from system ..."
sudo apt-get purge nginx nginx-common -y sudo apt-get purge nginx nginx-common -y
sudo update-rc.d -f nginx remove
CONFIRM_MSG=" Nginx successfully removed!" CONFIRM_MSG=" Nginx successfully removed!"
else else
ERROR_MSG=" Looks like Nginx was already removed!\n Skipping..." ERROR_MSG=" Looks like Nginx was already removed!\n Skipping..."