Browse Source

Update v-change-sys-webmail

Kristan Kenney 6 years ago
parent
commit
12f4f699c5
1 changed files with 5 additions and 14 deletions
  1. 5 14
      bin/v-change-sys-webmail

+ 5 - 14
bin/v-change-sys-webmail

@@ -9,9 +9,6 @@
 #                    Variable&Function                     #
 #----------------------------------------------------------#
 
-# Argument definition
-WEBMAIL=$1
-
 # Includes
 source $HESTIA/func/main.sh
 source $HESTIA/conf/hestia.conf
@@ -23,12 +20,6 @@ export $WEBMAIL_ALIAS
 OLD_ALIAS=$WEBMAIL_ALIAS
 NEW_ALIAS=$1
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '1' "$#" 'WEBMAIL'
-
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
@@ -41,7 +32,7 @@ for user in `ls /usr/local/hestia/data/users/`; do
 done
 
 # Set new webmail alias
-$BIN/v-change-sys-config-value 'WEBMAIL_ALIAS' '$NEW_ALIAS'
+$BIN/v-change-sys-config-value 'WEBMAIL_ALIAS' $NEW_ALIAS
 
 for user in `ls /usr/local/hestia/data/users/`; do
     for domain in $($BIN/v-list-web-domains $user plain |cut -f 1); do
@@ -49,9 +40,9 @@ for user in `ls /usr/local/hestia/data/users/`; do
     done
 done
 
-# Update alias (non-subdomain) configuration to match
-sed -i "s|Alias \/webmail|Alias \/$NEW_ALIAS|gI" /etc/apache2/conf.d/roundcube.conf
-sed -i "s|location \/webmail|location \/$NEW_ALIAS|gI" /etc/nginx/conf.d/webmail.inc
+# Update global directory alias configuration
+sed -i "s|Alias \/$OLD_ALIAS|Alias \/$NEW_ALIAS|gI" /etc/apache2/conf.d/roundcube.conf
+sed -i "s|location \/$OLD_ALIAS|location \/$NEW_ALIAS|gI" /etc/nginx/conf.d/webmail.inc
 
 #----------------------------------------------------------#
 #                       Hestia                             #
@@ -62,7 +53,7 @@ $BIN/v-restart-web $restart
 $BIN/v-restart-proxy $restart
 
 # Logging
-log_history "changed system webmail alias to $NEW_ALIAS"
+log_history "changed global webmail alias to $NEW_ALIAS"
 log_event "$OK" "$ARGUMENTS"
 
 exit