Serghey Rodin 12 лет назад
Родитель
Сommit
22ab6d500c
4 измененных файлов с 32 добавлено и 11 удалено
  1. 9 1
      bin/v-add-remote-dns-host
  2. 9 1
      bin/v-delete-remote-dns-host
  3. 13 8
      bin/v-sync-dns-cluster
  4. 1 1
      bin/v-update-sys-queue

+ 9 - 1
bin/v-add-remote-dns-host

@@ -58,12 +58,20 @@ else
 fi
 
 # Sync current zones
-$BIN/v-sync-dns-cluster
+$BIN/v-sync-dns-cluster $host
 return_code=$?
 if [ "$return_code" -ne 0 ]; then
     exit $return_code
 fi
 
+# Add cron job
+cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
+check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
+if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
+    $BIN/v-add-cron-job admin '*/5' '*' '*' '*' '*' "$cmd"
+fi
+
+
 #----------------------------------------------------------#
 #                       Vesta                              #
 #----------------------------------------------------------#

+ 9 - 1
bin/v-delete-remote-dns-host

@@ -37,11 +37,19 @@ $BIN/v-delete-remote-dns-domains $host >>/dev/null 2>&1
 # Deleting server
 sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf
 
-# Disabling DNS_CLUSTER
+# Delete DNS_CLUSTER key
 check_cluster=$(grep HOST $VESTA/conf/dns-cluster.conf |wc -l)
 if [ "$check_cluster" -eq '0' ]; then
     rm -f $VESTA/conf/dns-cluster.conf
     sed -i "/DNS_CLUSTER=/d" $VESTA/conf/vesta.conf
+
+    # Delete cron job
+    cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
+    check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
+    if [ ! -z "$check_cron" ]; then
+        eval $check_cron
+        $BIN/v-delete-cron-job admin "$JOB"
+    fi
 fi
 
 

+ 13 - 8
bin/v-sync-dns-cluster

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: synchronize dns domains
-#
+# options: HOST
 # The function synchronize all dns domains.
 
 
@@ -9,7 +9,8 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-verbose=$1
+host=$1
+verbose=$2
 
 # Includes
 source $VESTA/conf/vesta.conf
@@ -44,8 +45,17 @@ fi
 old_ifs="$IFS"
 IFS=$'\n'
 
+if [ -z $host ]; then
+    hosts=$(cat $VESTA/conf/dns-cluster.conf)
+    rm -f $VESTA/data/queue/dns-cluster.pipe
+    touch $VESTA/data/queue/dns-cluster.pipe
+    chmod 660 $VESTA/data/queue/dns-cluster.pipe
+else
+    hosts=$(grep "HOST='$host'" $VESTA/conf/dns-cluster.conf)
+fi
+
 # Starting cluster loop
-for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
+for cluster_str in $hosts; do
 
     # Get host values
     eval $cluster_str
@@ -108,11 +118,6 @@ for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
         exit $E_CONNECT
     fi
 
-    # Clean queue
-    rm -f $VESTA/data/queue/dns-cluster.pipe
-    touch $VESTA/data/queue/dns-cluster.pipe
-    chmod 660 $VESTA/data/queue/dns-cluster.pipe
-
     # Start user loop
     for user in $user_list; do
 

+ 1 - 1
bin/v-update-sys-queue

@@ -53,7 +53,7 @@ case $queue in
     backup)         bash $VESTA/data/queue/$queue.pipe > /dev/null 2>&1 ;;
     disk)           bash $VESTA/data/queue/$queue.pipe ;;
     traffic)        bash $VESTA/data/queue/$queue.pipe ;;
-    dns-cluster)    bash $VESTA/data/queue/$queue.pipe ;;
+    dns-cluster)    bash $VESTA/data/queue/$queue.pipe > /dev/null 2>&1 ;;
     *)              check_args '1' '0' 'QUEUE' ;;
 esac