فهرست منبع

Small fixes in webmail alias change.

Raphael Schneeberger 7 سال پیش
والد
کامیت
62de76675a
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      bin/v-change-sys-webmail

+ 4 - 4
bin/v-change-sys-webmail

@@ -34,15 +34,15 @@ if [ -f /etc/apache2/conf.d/roundcube.conf ]; then
 fi
 fi
 
 
 # Get existing nginx webmail alias
 # Get existing nginx webmail alias
-if [ -f /etc/nginx/conf.d/roundcube.inc ]; then
+if [ -f /etc/nginx/conf.d/webmail.inc ]; then
     nginx_webmail=$(cat /etc/nginx/conf.d/webmail.inc | grep "location" | { IFS=' '; read -r -a array; echo "${array[1]}"; })
     nginx_webmail=$(cat /etc/nginx/conf.d/webmail.inc | grep "location" | { IFS=' '; read -r -a array; echo "${array[1]}"; })
 fi
 fi
 
 
 # Check if alias is different for apache2
 # Check if alias is different for apache2
-if [ -z "$apache_webmail" ]; then
+if [ ! -z "$apache_webmail" ]; then
     if [ ! "$apache_webmail" = "$WEBMAIL" ]; then
     if [ ! "$apache_webmail" = "$WEBMAIL" ]; then
         # Replace webmail alias in config files.
         # Replace webmail alias in config files.
-        sed -i "3/s|Alias $apache_webmail|Alias $WEBMAIL|" /etc/apache2/conf.d/roundcube.conf
+        sed -i "s|Alias $apache_webmail|Alias $WEBMAIL|" /etc/apache2/conf.d/roundcube.conf
 
 
         # Restart services
         # Restart services
         $HESTIA/bin/v-restart-service apache2
         $HESTIA/bin/v-restart-service apache2
@@ -50,7 +50,7 @@ if [ -z "$apache_webmail" ]; then
 fi
 fi
 
 
 # Check if alias is different for nginx
 # Check if alias is different for nginx
-if [ -z "$nginx_webmail" ]; then
+if [ ! -z "$nginx_webmail" ]; then
     if [ ! "$nginx_webmail" = "$WEBMAIL" ]; then
     if [ ! "$nginx_webmail" = "$WEBMAIL" ]; then
         # Replace webmail alias in config files.
         # Replace webmail alias in config files.
         sed -i "s|$nginx_webmail|$WEBMAIL|" /etc/nginx/conf.d/webmail.inc
         sed -i "s|$nginx_webmail|$WEBMAIL|" /etc/nginx/conf.d/webmail.inc