mirror of
https://github.com/myvesta/vesta
synced 2025-07-15 01:23:23 -07:00
simple way to remove old configs
This commit is contained in:
parent
844168f53f
commit
6f28668e40
2 changed files with 14 additions and 21 deletions
|
@ -111,38 +111,32 @@ rm -f /var/log/httpd/domains/$domain.error*
|
|||
sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf
|
||||
|
||||
# Checking last ssl domain
|
||||
conf='/etc/httpd/conf.d/vesta.conf'
|
||||
ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf | wc -l)
|
||||
if [ "$ssl_dom" -eq '0' ]; then
|
||||
sed -i "s/ Include /#Include /" $HOMEDIR/$user/conf/web/httpd.conf
|
||||
sed -i "/.*\/$user\/.*shttpd.conf/d" $conf
|
||||
rm -f $HOMEDIR/$user/conf/web/shttpd.conf
|
||||
fi
|
||||
|
||||
# Checking last domain
|
||||
domains=$(wc -l $USER_DATA/web.conf|cut -f 1 -d ' ')
|
||||
if [ "$domains" -eq '0' ]; then
|
||||
conf='/etc/httpd/conf.d/vesta.conf'
|
||||
line=$(grep -n "$HOMEDIR/$user/conf/web/httpd.conf" $conf | cut -f 1 -d : )
|
||||
if [ ! -z "$line" ]; then
|
||||
sed -i "$line d" $conf
|
||||
fi
|
||||
sed -i "/.*\/$user\/.*httpd.conf/d" $conf
|
||||
rm -f $HOMEDIR/$user/conf/web/httpd.conf
|
||||
fi
|
||||
|
||||
# Checking last nginx domain
|
||||
# Checking last ssl nginx domain
|
||||
conf='/etc/nginx/conf.d/vesta_users.conf'
|
||||
last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
|
||||
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
|
||||
if [ -z "$last_snginx" ]; then
|
||||
sline=$(grep -n "$HOMEDIR/$user/conf/web/snginx.conf" $conf |cut -f 1 -d :)
|
||||
if [ ! -z "$sline" ]; then
|
||||
sed -i "$sline d" $conf
|
||||
fi
|
||||
sed -i "/.*\/$user\/.*snginx.conf/d" $conf
|
||||
rm -f $HOMEDIR/$user/conf/web/snginx.conf
|
||||
fi
|
||||
|
||||
# Checking last nginx domain
|
||||
last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
|
||||
if [ -z "$last_nginx" ]; then
|
||||
line=$(grep -n "$HOMEDIR/$user/conf/web/nginx.conf" $conf | cut -f 1 -d : )
|
||||
if [ ! -z "$line" ]; then
|
||||
sed -i "$line d" $conf
|
||||
fi
|
||||
sed -i "/.*\/$user\/.*nginx.conf/d" $conf
|
||||
rm -f $HOMEDIR/$user/conf/web/nginx.conf
|
||||
fi
|
||||
|
||||
|
|
|
@ -70,11 +70,10 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SSL' 'no'
|
|||
|
||||
# Checking last ssl domain
|
||||
ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf)
|
||||
main_conf='/etc/httpd/conf.d/vesta.conf'
|
||||
conf="$HOMEDIR/$user/conf/web/shttpd.conf"
|
||||
conf='/etc/httpd/conf.d/vesta.conf'
|
||||
if [ -z "$ssl_dom" ]; then
|
||||
sed -i "/Include ${conf////\/}/d" $main_conf
|
||||
rm -f $conf
|
||||
sed -i "/.*\/$user\/.*shttpd.conf/d" $conf
|
||||
rm -f $HOMEDIR/$user/conf/web/shttpd.conf
|
||||
fi
|
||||
|
||||
# Checking last nginx domain
|
||||
|
@ -82,7 +81,7 @@ conf='/etc/nginx/conf.d/vesta_users.conf'
|
|||
last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
|
||||
last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
|
||||
if [ -z "$last_snginx" ]; then
|
||||
sed -i "/$user\/conf\/web\/snginx.conf/d" $conf
|
||||
sed -i "/.*\/$user\/.*snginx.conf/d" $conf
|
||||
rm -f $HOMEDIR/$user/conf/web/snginx.conf
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue