Skip to content

Commit f5471fe

Browse files
committed
added option to control restart behaviour
1 parent 9e79206 commit f5471fe

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

bin/v-add-domain

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# info: add web/dns/mail domain
3-
# options: USER DOMAIN [IP]
3+
# options: USER DOMAIN [IP] [RESTART]
44
#
55
# The function adds web/dns/mail domain to a server.
66

@@ -13,6 +13,7 @@
1313
user=$1
1414
domain=$2
1515
ip=$3
16+
restart="${4-yes}"
1617

1718
# Includes
1819
source $VESTA/func/main.sh
@@ -24,9 +25,9 @@ source $VESTA/conf/vesta.conf
2425
# Verifications #
2526
#----------------------------------------------------------#
2627

27-
check_args '2' "$#" 'USER DOMAIN [IP]'
28+
check_args '2' "$#" 'USER DOMAIN [IP] [RESTART]'
2829
validate_format 'user' 'domain'
29-
if [ ! -z "$ip" ]; then
30+
if [ ! -z "$ip" ] ; then
3031
validate_format 'ip'
3132
fi
3233
is_object_valid 'user' 'USER' "$user"
@@ -50,20 +51,23 @@ fi
5051
# Web domain
5152
# Do Not restart at this point, will loose connection from API calls
5253
if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
53-
$BIN/v-add-web-domain $user $domain $ip no
54+
$BIN/v-add-web-domain $user $domain $ip 'no'
5455
return_code=$?
5556
fi
5657

5758
# Proxy support
5859
# Do Not restart at this point, will loose connection from API calls
5960
if [ ! -z "$PROXY_SYSTEM" ] && [ "$return_code" -eq 0 ]; then
60-
$BIN/v-add-web-domain-proxy $user $domain '' '' no
61+
extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls"
62+
extentions="$extentions,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav"
63+
extentions="$extentions,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
64+
$BIN/v-add-web-domain-proxy $user $domain 'default' "$extentions" 'no'
6165
fi
6266

6367
# DNS domain
6468
if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
6569
if [ "$return_code" -eq 0 ]; then
66-
$BIN/v-add-dns-domain $user $domain $ip
70+
$BIN/v-add-dns-domain $user $domain $ip 'no'
6771
return_code=$?
6872
fi
6973
fi
@@ -76,6 +80,13 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
7680
fi
7781
fi
7882

83+
# Restart services
84+
if [ "$restart" != 'no' ] && [ "$return_code" -eq 0 ]; then
85+
$BIN/v-restart-web
86+
$BIN/v-restart-proxy
87+
$BIN/v-restart-dns
88+
fi
89+
7990

8091
#----------------------------------------------------------#
8192
# Vesta #

0 commit comments

Comments
 (0)