88# Argument defenition
99user=" $1 "
1010
11+
1112# Importing variables
1213source $VESTA /conf/vars.conf
1314source $V_FUNC /shared_func.sh
1415source $V_FUNC /domain_func.sh
1516source $V_FUNC /ip_func.sh
1617
18+ url=" ${2-$V_SUSPEND_URL } "
1719
1820# ----------------------------------------------------------#
1921# Verifications #
2022# ----------------------------------------------------------#
2123
2224# Checking arg number
23- check_args ' 1' " $# " ' user'
25+ check_args ' 1' " $# " ' user [suspend_url] '
2426
2527# Checking argument format
26- format_validation ' user'
28+ format_validation ' user' ' url '
2729
2830# Checking web system is enabled
2931is_system_enabled ' web'
@@ -48,7 +50,7 @@ search_string="DOMAIN"
4850# Defining fileds to select
4951field=' $DOMAIN'
5052
51- # Parsing unsuspeneded domains
53+ # Parsing all domains
5254domains=$( dom_clear_search)
5355
5456# Starting loop
@@ -59,13 +61,13 @@ for domain in $domains; do
5961 tpl_file=" $V_WEBTPL /apache_$template .tpl"
6062 ip=$( get_web_domain_value ' $IP' )
6163 web_port=$( get_config_value ' $WEB_PORT' )
62- domain=$( get_web_domain_value ' $DOMAIN' )
6364 domain_idn=$( idn -t --quiet -a " $domain " )
6465 group=" $user "
6566 docroot=" $V_HOME /$user /web/$domain /public_html"
6667 email=" $user @$domain "
6768 aliases=$( get_web_domain_value ' $ALIAS' )
6869 aliases_idn=$( idn -t --quiet -a " $aliases " )
70+ suspend=$( get_web_domain_value ' $SUSPEND' )
6971
7072 # Checking error log status
7173 elog=$( get_web_domain_value ' $ELOG' )
@@ -99,6 +101,18 @@ for domain in $domains; do
99101 change_web_config
100102 fi
101103
104+ # Checking suspend
105+ if [ " $suspend " = ' yes' ]; then
106+ # Defining search phrase
107+ search_phrase=' DocumentRoot '
108+
109+ # Defining replace string
110+ str_repl=" Redirect / http://$url "
111+
112+ # Suspending vhost
113+ change_web_config
114+ fi
115+
102116 # Checking ssl
103117 cert=$( get_web_domain_value ' $SSL_CERT' )
104118 if [ ! -z " $cert " ]; then
@@ -136,23 +150,50 @@ for domain in $domains; do
136150 str_repl=' Options +Includes -Indexes -ExecCGI'
137151 change_web_config
138152 fi
153+
154+ # Checking suspend
155+ if [ " $suspend " = ' yes' ]; then
156+ # Defining search phrase
157+ search_phrase=' DocumentRoot '
158+
159+ # Defining replace string
160+ str_repl=" Redirect / http://$url "
161+
162+ # Suspending vhost
163+ change_web_config
164+ fi
139165 fi
140166
141167 # Checking nginx
142168 nginx=$( get_web_domain_value ' $NGINX' )
143169 if [ ! -z " $nginx " ]; then
144170 proxy_port=$( get_config_value ' $PROXY_PORT' )
145- ext =$( get_web_domain_value ' $NGINX_EXT' )
171+ extentions =$( get_web_domain_value ' $NGINX_EXT' )
146172 tpl_file=" $V_WEBTPL /ngingx_vhost_$nginx .tpl"
147173 conf=" $V_HOME /$user /conf/tmp_nginx.conf"
148174 add_web_config
149175
176+ if [ " $suspend " = ' yes' ]; then
177+ search_phrase=' proxy_pass'
178+ str_repl=" rewrite ^(.*)\$ http://$url ;"
179+ change_web_config
180+ fi
181+
150182 if [ ! -z " $cert " ]; then
151- proxy_ssl_port=$( get_config_value ' $PROXY_SSL_PORT' )
152183 tpl_file=" $V_WEBTPL /ngingx_vhost_$nginx .stpl"
153184 conf=" $V_HOME /$user /conf/tmp_snginx.conf"
154185 add_web_config
186+
187+ if [ " $suspend " = ' yes' ]; then
188+ search_phrase=' proxy_pass'
189+ str_repl=" rewrite ^(.*)\$ http://$url ;"
190+ change_web_config
191+ fi
192+
155193 fi
194+
195+
196+ ngix_change=' yes'
156197 fi
157198
158199done
@@ -185,12 +226,13 @@ if [ ! -z "$ssl_cert" ]; then
185226fi
186227
187228# Checking nginx
188- if [ ! -z " $nginx " ]; then
229+ if [ " $ngix_change " = ' yes ' ]; then
189230 nginx_conf=' /etc/nginx/conf.d/vesta_users.conf'
190231 tmp_conf=" $V_HOME /$user /conf/tmp_nginx.conf"
191232 conf=" $V_HOME /$user /conf/nginx.conf"
192233 mv $tmp_conf $conf
193234
235+
194236 nginx_conf_check=$( grep " $conf " $nginx_conf )
195237 if [ -z " $nginx_conf_check " ]; then
196238 echo " include $conf ;" >> $nginx_conf
0 commit comments