From 8b5615514ef90461026f4dff60782d9e29ad2c1b Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Wed, 21 Sep 2011 11:59:47 +0300 Subject: [PATCH] fixed nginx config removal --- bin/v_del_web_domain | 20 ++++++++++++++++++++ bin/v_del_web_domain_nginx | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bin/v_del_web_domain b/bin/v_del_web_domain index c7b2b864..606f1817 100755 --- a/bin/v_del_web_domain +++ b/bin/v_del_web_domain @@ -116,6 +116,26 @@ if [ "$domains" -eq '0' ]; then fi fi +# Checking last nginx domain +conf='/etc/nginx/conf.d/vesta_users.conf' +last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf) +last_snginx=$(echo "$last_nginx" | grep -v "SSL_CERT=''") +if [ -z "$last_snginx" ]; then + sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : ) + if [ ! -z "$sline" ]; then + sed -i "$sline d" $conf + fi + rm -f $V_HOME/$user/conf/snginx.conf +fi + +if [ -z "$last_nginx" ]; then + line=$(grep -n "$V_HOME/$user/conf/nginx.conf" $conf | cut -f 1 -d : ) + if [ ! -z "$line" ]; then + sed -i "$line d" $conf + fi + rm -f $V_HOME/$user/conf/nginx.conf +fi + # Decreasing ip value decrease_ip_value "$old_ip" diff --git a/bin/v_del_web_domain_nginx b/bin/v_del_web_domain_nginx index ee0a584f..0fb3ff12 100755 --- a/bin/v_del_web_domain_nginx +++ b/bin/v_del_web_domain_nginx @@ -79,7 +79,7 @@ update_web_domain_value '$NGINX_EXT' '' conf='/etc/nginx/conf.d/vesta_users.conf' last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf) last_snginx=$(echo "$last_nginx" | grep -v "SSL_CERT=''") -if [ -z "$last_snginx" ]; then +if [ -z "$last_snginx" ]; then sline=$(grep -n "$V_HOME/$user/conf/snginx.conf" $conf | cut -f 1 -d : ) if [ ! -z "$sline" ]; then sed -i "$sline d" $conf @@ -87,7 +87,7 @@ if [ -z "$last_snginx" ]; then rm -f $V_HOME/$user/conf/snginx.conf fi -if [ -z "$last_nginx" ]; then +if [ -z "$last_nginx" ]; then line=$(grep -n "$V_HOME/$user/conf/nginx.conf" $conf | cut -f 1 -d : ) if [ ! -z "$line" ]; then sed -i "$line d" $conf