v-change-dns-domain-exp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # info: change dns domain expiriation 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 defenition
  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/conf/vesta.conf
  17. source $VESTA/func/main.sh
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. check_args '3' "$#" 'USER DOMAIN EXP'
  22. validate_format 'user' 'domain' 'exp'
  23. is_system_enabled "$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. # dns-cluster
  34. if [ ! -z "$DNS_CLUSTER" ]; then
  35. cmd="v-change-remote-dns-domain-exp $user $domain"
  36. echo "$cmd" >> $VESTA/data/queue/dns-cluster.pipe
  37. fi
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. # Logging
  42. log_history "changed whois expiriation date for $domain"
  43. log_event "$OK" "$EVENT"
  44. exit