11#! /bin/bash
22# info: add remote dns domain
3- # options: USER DOMAIN
3+ # options: USER DOMAIN [FLUSH]
44#
55# The function synchronize dns domain with the remote server.
66
1212# Argument defenition
1313user=$1
1414domain=$2
15+ flush=$3
1516
1617# Includes
1718source $VESTA /func/main.sh
@@ -23,7 +24,7 @@ source $VESTA/conf/vesta.conf
2324# Verifications #
2425# ----------------------------------------------------------#
2526
26- check_args ' 2' " $# " ' USER DOMAIN'
27+ check_args ' 2' " $# " ' USER DOMAIN [FLUSH] '
2728validate_format ' user' ' domain'
2829is_system_enabled " $DNS_CLUSTER " ' DNS_CLUSTER'
2930
@@ -89,10 +90,13 @@ for cluster_str in $search_str; do
8990 DNS_CLUSTER_IGNORE=' dns-cluster'
9091 fi
9192
93+ # Check flush parameters
94+
9295 # Sync domain
9396 str=$( grep " DOMAIN='$domain '" $USER_DATA /dns.conf)
9497 eval $str
95- $send_cmd v-insert-dns-domain $DNS_USER " $str " $HOSTNAME ' flush' ' no'
98+
99+ $send_cmd v-insert-dns-domain $DNS_USER " $str " $HOSTNAME " $flush " ' no'
96100 if [ $? -eq 0 ]; then
97101 # Sync records
98102 if [ " $TYPE " = ' ssh' ]; then
@@ -120,12 +124,11 @@ done
120124# Update pipe
121125rm -f $tmpfile
122126pipe=" $VESTA /data/queue/dns-cluster.pipe"
123- str=$( grep -n " $SCRIPT $1 $2 $ " $pipe | cut -f1 -d: | head -n1)
127+ str=$( grep -n " $SCRIPT $1 $2 " $pipe | cut -f1 -d: | head -n1)
124128if [ ! -z " $str " ]; then
125129 sed -i " $str d" $pipe
126130fi
127131
128-
129132# ----------------------------------------------------------#
130133# Vesta #
131134# ----------------------------------------------------------#
0 commit comments