@@ -18,7 +18,7 @@ NGINX_CONFIG="$HESTIA/nginx/conf/nginx.conf"
1818# shellcheck source=/etc/hestiacp/hestia.conf
1919source /etc/hestiacp/hestia.conf
2020# shellcheck source=/usr/local/hestia/func/main.sh
21- source $HESTIA /func/main.sh
21+ source " $HESTIA /func/main.sh"
2222# load config file
2323source_conf " $HESTIA /conf/hestia.conf"
2424
@@ -55,18 +55,18 @@ check_hestia_demo_mode
5555# ----------------------------------------------------------#
5656
5757# Get original port
58- LISTEN_ROWS=$( cat ${ NGINX_CONFIG} | grep -c " listen" )
59- ORIGINAL_PORT=$( cat ${NGINX_CONFIG} | grep -m1 " listen" | sed ' s/ [^0-9]*//g ' )
58+ LISTEN_ROWS=$( cat " $ NGINX_CONFIG" | grep -c " listen" )
59+ ORIGINAL_PORT=$( sed -ne " / listen/{s/.*listen [^0-9]*\([0-9][0-9]*\)[ \t]*ssl\;/\1/p;q} " " $NGINX_CONFIG " )
6060
6161# Check if port is different to nginx.conf
6262if [ " $ORIGINAL_PORT " = " $PORT " ]; then
6363 # Nothing to do, exit
6464 exit
6565else
6666 # Set new port in config via v-change-sys-config-value
67- $BIN /v-change-sys-config-value " BACKEND_PORT" " $PORT "
67+ " $BIN /v-change-sys-config-value" " BACKEND_PORT" " $PORT "
6868 # Replace port in config files.
69- sed -i " s/\(listen[ \t]*.*[: \t]\)[0-9][0-9]*\([^0-9]*ssl\;$\)/\1$PORT \2/" ${ NGINX_CONFIG}
69+ sed -i " s/\(listen[ \t]*.*[: \t]\)[0-9][0-9]*\([^0-9]*ssl\;$\)/\1$PORT \2/" " $ NGINX_CONFIG"
7070 if [ -d /etc/roundcube/ ]; then
7171 sed -i " /password_hestia_port/c\$ rcmail_config['password_hestia_port'] = '$PORT ';" /etc/roundcube/plugins/password/config.inc.php
7272 fi
7575 fi
7676
7777 if [ -f " $HESTIA /data/firewall/rules.conf" ]; then
78- sed -i " /COMMENT='HESTIA'/c\RULE='2' ACTION='ACCEPT' PROTOCOL='TCP' PORT='$PORT ' IP='0.0.0.0/0' COMMENT='HESTIA' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'" $HESTIA /data/firewall/rules.conf
78+ sed -i " /COMMENT='HESTIA'/c\RULE='2' ACTION='ACCEPT' PROTOCOL='TCP' PORT='$PORT ' IP='0.0.0.0/0' COMMENT='HESTIA' SUSPENDED='no' TIME='07:40:16' DATE='2014-05-25'" " $HESTIA /data/firewall/rules.conf"
7979 fi
8080
81- if [ -f $HESTIA /data/firewall/chains.conf ]; then
82- sed -i " /CHAIN='HESTIA'/c\CHAIN='HESTIA' PORT='$PORT ' PROTOCOL='TCP'" $HESTIA /data/firewall/chains.conf
81+ if [ -f " $HESTIA /data/firewall/chains.conf" ]; then
82+ sed -i " /CHAIN='HESTIA'/c\CHAIN='HESTIA' PORT='$PORT ' PROTOCOL='TCP'" " $HESTIA /data/firewall/chains.conf"
8383 fi
8484
8585 # Restart services
8686 if [ -n " $FIREWALL_SYSTEM " ] && [ " $FIREWALL_SYSTEM " != no ]; then
87- $BIN /v-restart-service iptables
87+ " $BIN /v-restart-service" iptables
8888 fi
8989
9090 # Check if Hestia is running
9191 if [[ $( ps -eaf | grep -i hestia | sed ' /^$/d' | wc -l) -gt 1 ]]; then
92- $BIN /v-restart-service hestia
92+ " $BIN /v-restart-service" hestia
9393 fi
9494fi
9595
9898# ----------------------------------------------------------#
9999
100100# Logging
101- $BIN /v-log-action " system" " Warning" " System" " Hestia Control Panel backend port changed (New Value: $PORT , Old Value: $ORIGINAL_PORT )."
101+ " $BIN /v-log-action" " system" " Warning" " System" " Hestia Control Panel backend port changed (New Value: $PORT , Old Value: $ORIGINAL_PORT )."
102102if [ $LISTEN_ROWS -gt 1 ]; then
103- $BIN /v-log-action " system" " Warning" " System" " Hestia Control Panel backend port: Use first of $LISTEN_ROWS listened ports in ${ NGINX_CONFIG} "
103+ " $BIN /v-log-action" " system" " Warning" " System" " Hestia Control Panel backend port: Use first of $LISTEN_ROWS listened ports in $NGINX_CONFIG "
104104fi
105105log_event " $OK " " $ARGUMENTS "
106106
0 commit comments