v-change-dns-domain-exp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. # info: change dns domain expiration date
  3. # options: USER DOMAIN EXP
  4. #
  5. # The function of changing the term of expiration domain's registration. The
  6. # serial number will be refreshed automatically during update.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument definition
  11. user=$1
  12. domain=$(idn -t --quiet -u "$2" )
  13. domain_idn=$(idn -t --quiet -a "$domain")
  14. exp=$3
  15. # Includes
  16. source $VESTA/func/main.sh
  17. source $VESTA/conf/vesta.conf
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. check_args '3' "$#" 'USER DOMAIN EXP'
  22. is_format_valid 'user' 'domain' 'exp'
  23. is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
  24. is_object_valid 'user' 'USER' "$user"
  25. is_object_unsuspended 'user' 'USER' "$user"
  26. is_object_valid 'dns' 'DOMAIN' "$domain"
  27. is_object_unsuspended 'dns' 'DOMAIN' "$domain"
  28. #----------------------------------------------------------#
  29. # Action #
  30. #----------------------------------------------------------#
  31. # Changing exp
  32. update_object_value 'dns' 'DOMAIN' "$domain" '$EXP' "$exp"
  33. # Updating dns-cluster queue
  34. if [ ! -z "$DNS_CLUSTER" ]; then
  35. # Check for first sync
  36. dlock=$(grep "domain $user $domain" $VESTA/data/queue/dns-cluster.pipe)
  37. if [ -z "$dlock" ]; then
  38. cmd="$BIN/v-change-remote-dns-domain-exp $user $domain $exp"
  39. echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
  40. fi
  41. fi
  42. #----------------------------------------------------------#
  43. # Vesta #
  44. #----------------------------------------------------------#
  45. # Logging
  46. log_history "changed whois expiration date for $domain"
  47. log_event "$OK" "$ARGUMENTS"
  48. exit