v-delete-remote-dns-domain 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. # info: delete remote dns domain
  3. # options: USER DOMAIN
  4. #
  5. # The function synchronize dns with the remote server.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. domain=$2
  12. # Includes
  13. source $VESTA/func/main.sh
  14. source $VESTA/func/remote.sh
  15. source $VESTA/conf/vesta.conf
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '2' "$#" 'USER DOMAIN'
  20. is_format_valid 'user' 'domain'
  21. is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER'
  22. is_procces_running
  23. remote_dns_health_check
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Starting cluster loop
  28. IFS=$'\n'
  29. for cluster in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do
  30. # Parsing remote host parameters
  31. eval $cluster
  32. # Syncing domain
  33. cluster_cmd v-delete-dns-domain $DNS_USER $domain 'yes'
  34. rc=$?
  35. if [ "$rc" -ne 0 ] && [ $rc -ne 3 ]; then
  36. check_result $rc "$HOST connection failed (sync)" $E_CONNECT
  37. fi
  38. done
  39. #----------------------------------------------------------#
  40. # Vesta #
  41. #----------------------------------------------------------#
  42. # Updating pipe
  43. pipe="$VESTA/data/queue/dns-cluster.pipe"
  44. str=$(grep -n "$SCRIPT $1 $2$" $pipe | cut -f1 -d: | head -n1)
  45. if [ ! -z "$str" ]; then
  46. sed -i "$str d" $pipe
  47. fi
  48. exit