Skip to content

Commit 7485463

Browse files
committed
added httpd config rebuild api
1 parent e26cc8c commit 7485463

File tree

2 files changed

+109
-164
lines changed

2 files changed

+109
-164
lines changed

bin/v_rebuild_web_domain

Lines changed: 0 additions & 164 deletions
This file was deleted.

bin/v_rebuild_web_domains

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/bash
2+
# info: rebuilding web domains
3+
4+
#----------------------------------------------------------#
5+
# Variable&Function #
6+
#----------------------------------------------------------#
7+
8+
# Argument defenition
9+
user="$1"
10+
11+
# Importing variables
12+
source $VESTA/conf/vars.conf
13+
source $V_FUNC/shared_func.sh
14+
source $V_FUNC/domain_func.sh
15+
source $V_FUNC/ip_func.sh
16+
17+
18+
#----------------------------------------------------------#
19+
# Verifications #
20+
#----------------------------------------------------------#
21+
22+
# Checking arg number
23+
check_args '1' "$#" 'user'
24+
25+
# Checking argument format
26+
format_validation 'user'
27+
28+
# Checking web system is enabled
29+
is_system_enabled 'web'
30+
31+
# Checking user
32+
is_user_valid
33+
34+
# Checking user is active
35+
is_user_suspended
36+
37+
38+
#----------------------------------------------------------#
39+
# Action #
40+
#----------------------------------------------------------#
41+
42+
# Defining config
43+
conf="$V_USERS/$user/web_domains.conf"
44+
45+
# Defining search string
46+
search_string="DOMAIN"
47+
48+
# Defining fileds to select
49+
field='$DOMAIN'
50+
51+
# Parsing unsuspeneded domains
52+
domains=$(dom_clear_search)
53+
54+
# Starting update disk loop
55+
for domain in $domains; do
56+
57+
# Defining domain parameters
58+
template=$(get_web_domain_value '$TPL')
59+
tpl_file="$V_WEBTPL/apache_$template.tpl"
60+
ip=$(get_web_domain_value '$IP')
61+
port=$(get_web_port)
62+
domain=$(get_web_domain_value '$DOMAIN')
63+
domain_idn=$(idn -t --quiet -a "$domain")
64+
group="$user"
65+
docroot="$V_HOME/$user/domains/$domain/public_html"
66+
email="$user@$domain"
67+
aliases=$(get_web_domain_value '$ALIAS')
68+
aliases_idn=$(idn -t --quiet -a "$aliases")
69+
70+
#ssl_cert=$()
71+
#ssl_key=$()
72+
73+
# Adding domain to the tmp_httpd.conf
74+
conf="$V_HOME/$user/conf/tmp_httpd.conf"
75+
httpd_add_config
76+
77+
# Running template trigger
78+
if [ -e $V_WEBTPL/apache_$template.sh ]; then
79+
$V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot $port
80+
fi
81+
82+
done
83+
84+
# Renaming tmp config
85+
tmp_conf="$conf"
86+
conf="$V_HOME/$user/conf/httpd.conf"
87+
mv $tmp_conf $conf
88+
89+
# Checking include in main httpd.conf
90+
main_conf='/etc/httpd/conf.d/vesta.conf'
91+
main_conf_check=$(grep "$conf" $main_conf )
92+
if [ -z "$main_conf_check" ]; then
93+
echo "Include $conf" >>$main_conf
94+
fi
95+
96+
exit
97+
98+
99+
#----------------------------------------------------------#
100+
# Vesta #
101+
#----------------------------------------------------------#
102+
103+
# Adding task to the vesta pipe
104+
restart_schedule 'web'
105+
106+
# Logging
107+
log_event 'system' "$V_EVENT"
108+
109+
exit $OK

0 commit comments

Comments
 (0)