v-change-remote-dns-domain-exp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. # info: change remote dns domain expiration date
  3. # options: USER DOMAIN
  4. #
  5. # The function synchronize dns domain 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_object_valid 'user' 'USER' "$user"
  23. is_object_valid 'dns' 'DOMAIN' "$domain"
  24. is_procces_running
  25. remote_dns_health_check
  26. #----------------------------------------------------------#
  27. # Action #
  28. #----------------------------------------------------------#
  29. IFS=$'\n'
  30. for cluster in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do
  31. # Parsing remote host parameters
  32. eval $cluster
  33. # Syncing domain
  34. str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
  35. cluster_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'no'
  36. check_result $? "$HOST connection failed (exp insert)" $E_CONNECT
  37. done
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. # Updating pipe
  42. pipe="$VESTA/data/queue/dns-cluster.pipe"
  43. str=$(grep -n "$SCRIPT $1 $2 $3$" $pipe | cut -f1 -d: | head -n1)
  44. if [ ! -z "$str" ]; then
  45. sed -i "$str d" $pipe
  46. fi
  47. exit