v_change_dns_domain_exp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_history "$EVENT"
  38. log_event "$OK" "$EVENT"
  39. exit