diff --git a/bin/v-add-remote-dns-domain b/bin/v-add-remote-dns-domain index 3cf38a5e4..b71a519da 100755 --- a/bin/v-add-remote-dns-domain +++ b/bin/v-add-remote-dns-domain @@ -53,7 +53,8 @@ IFS=$'\n' # Check remote dns nodes remote_dns_health_check -for cluster_str in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do +search_str=$(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf) +for cluster_str in $search_str; do # Get host values eval $cluster_str @@ -83,25 +84,26 @@ for cluster_str in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf) eval $str $send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'flush' 'no' + if [ $? -eq 0 ]; then + # Sync records + if [ "$TYPE" = 'ssh' ]; then + tmp=$(mktemp -u) + scp_cmd $USER_DATA/dns/$DOMAIN.conf $tmp + $send_cmd v-insert-dns-records $DNS_USER $DOMAIN $tmp 'no' + else + for str in $(cat $USER_DATA/dns/$DOMAIN.conf); do + str=$(echo "$str" | sed 's/"/\\"/g') + $send_cmd v-insert-dns-record $DNS_USER $DOMAIN "$str" + done + fi - # Sync records - if [ "$TYPE" = 'ssh' ]; then - tmp=$(mktemp -u) - scp_cmd $USER_DATA/dns/$DOMAIN.conf $tmp - $send_cmd v-insert-dns-records $DNS_USER $DOMAIN $tmp 'no' - else - for str in $(cat $USER_DATA/dns/$DOMAIN.conf); do - str=$(echo "$str" | sed 's/"/\\"/g') - $send_cmd v-insert-dns-record $DNS_USER $DOMAIN "$str" - done - fi - - # Rebuild dns zone - $send_cmd v-rebuild-dns-domain $DNS_USER $domain 'scheduled' - if [ $? -ne 0 ]; then - echo "Error: $TYPE connection to $HOST failed" - log_event "$E_CONNECT $EVENT" - exit $E_CONNECT + # Rebuild dns zone + $send_cmd v-rebuild-dns-domain $DNS_USER $domain 'scheduled' + if [ $? -ne 0 ]; then + echo "Error: $TYPE connection to $HOST failed" + log_event "$E_CONNECT $EVENT" + exit $E_CONNECT + fi fi done diff --git a/bin/v-add-remote-dns-record b/bin/v-add-remote-dns-record index 0dce7e540..ca9aaa0e9 100755 --- a/bin/v-add-remote-dns-record +++ b/bin/v-add-remote-dns-record @@ -84,13 +84,14 @@ for cluster_str in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do str=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf) str=$(echo "$str" | sed 's/"/\\"/g') $send_cmd v-insert-dns-record $DNS_USER $domain "$str" 'no' - - # Rebuild dns zone - $send_cmd v-rebuild-dns-domain $DNS_USER $domain 'scheduled' - if [ $? -ne 0 ]; then - echo "Error: $TYPE connection to $HOST failed (rebuild)" - log_event "$E_CONNECT $EVENT" - exit $E_CONNECT + if [ $? -eq 0 ]; then + # Rebuild dns zone + $send_cmd v-rebuild-dns-domain $DNS_USER $domain 'scheduled' + if [ $? -ne 0 ]; then + echo "Error: $TYPE connection to $HOST failed (rebuild)" + log_event "$E_CONNECT $EVENT" + exit $E_CONNECT + fi fi done diff --git a/bin/v-change-domain-owner b/bin/v-change-domain-owner index 967c61fed..708c35c6d 100755 --- a/bin/v-change-domain-owner +++ b/bin/v-change-domain-owner @@ -116,6 +116,11 @@ if [ ! -z "$dns_data" ]; then $BIN/v-unsuspend-dns-domain $user $domain no >> /dev/null 2>&1 $BIN/v-rebuild-dns-domains $owner no $BIN/v-rebuild-dns-domains $user + + # Resync dns cluster + if [ ! -z "$DNS_CLUSTER" ]; then + v-sync-dns-cluster + fi fi # MAIL domain diff --git a/bin/v-change-remote-dns-domain-exp b/bin/v-change-remote-dns-domain-exp index 69f3450f3..9cd4a37bd 100755 --- a/bin/v-change-remote-dns-domain-exp +++ b/bin/v-change-remote-dns-domain-exp @@ -93,7 +93,7 @@ done # Update pipe pipe="$VESTA/data/queue/dns-cluster.pipe" -str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1) +str=$(grep -n "$SCRIPT $1 $2 $3$" $pipe | cut -f1 -d: | head -n1) if [ ! -z "$str" ]; then sed -i "$str d" $pipe fi diff --git a/bin/v-change-remote-dns-domain-soa b/bin/v-change-remote-dns-domain-soa index 772695b43..596954a77 100755 --- a/bin/v-change-remote-dns-domain-soa +++ b/bin/v-change-remote-dns-domain-soa @@ -96,7 +96,7 @@ done # Update pipe pipe="$VESTA/data/queue/dns-cluster.pipe" -str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1) +str=$(grep -n "$SCRIPT $1 $2 $3$" $pipe | cut -f1 -d: | head -n1) if [ ! -z "$str" ]; then sed -i "$str d" $pipe fi diff --git a/bin/v-change-remote-dns-domain-ttl b/bin/v-change-remote-dns-domain-ttl index 5aa3c5477..390ac9baa 100755 --- a/bin/v-change-remote-dns-domain-ttl +++ b/bin/v-change-remote-dns-domain-ttl @@ -111,7 +111,7 @@ done # Update pipe pipe="$VESTA/data/queue/dns-cluster.pipe" -str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1) +str=$(grep -n "$SCRIPT $1 $2 $3$" $pipe | cut -f1 -d: | head -n1) if [ ! -z "$str" ]; then sed -i "$str d" $pipe fi