Browse Source

Fix DNS restore/sync process

* Replace DNS records with new IP when changed
* Add missing user to DNS restore
* Sync domains on restore with remote cluster
Kristan Kenney 7 years ago
parent
commit
7e4e973c24
1 changed files with 11 additions and 0 deletions
  1. 11 0
      bin/v-restore-user

+ 11 - 0
bin/v-restore-user

@@ -504,8 +504,19 @@ if [ "$dns" != 'no' ] && [ ! -z "$DNS_SYSTEM" ]; then
         # Restoring DNS records
         cp -f $tmpdir/dns/$domain/$backup_system/$domain.conf $USER_DATA/dns/
 
+        # Update IP in records
+        if [ ! -z "$old_ip" ]; then
+            sed -i s/$old_ip/$IP/g $USER_DATA/dns/$domain.conf
+        fi
+
         # Rebuilding DNS domain
         rebuild_dns_domain_conf
+
+        # Updating dns-cluster queue
+        if [ ! -z "$DNS_CLUSTER" ]; then
+            cmd="$BIN/v-add-remote-dns-domain $user $domain yes"
+            echo "$cmd" >> $HESTIA/data/queue/dns-cluster.pipe
+        fi
     done
 
     # Restarting DNS