v_change_dns_domain_exp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # info: changing dns domain exp date
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user=$1
  8. domain=$(idn -t --quiet -u "$2" )
  9. domain_idn=$(idn -t --quiet -a "$domain")
  10. exp=$3
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_CONF/vesta.conf
  14. source $V_FUNC/shared.func
  15. source $V_FUNC/domain.func
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. # Checking arg number
  20. check_args '3' "$#" 'user domain exp'
  21. # Checking argument format
  22. format_validation 'user' 'domain' 'exp'
  23. # Checking web system is enabled
  24. is_system_enabled 'dns'
  25. # Checking user
  26. is_user_valid
  27. # Checking user is active
  28. is_user_suspended
  29. # Checking domain exist
  30. is_dns_domain_valid
  31. # Checking domain is not suspened
  32. is_domain_suspended 'dns'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Get old expiriation date
  37. old_exp=$(get_dns_domain_value '$EXP')
  38. # Changing exp
  39. update_dns_domain_value '$EXP' "$exp"
  40. #----------------------------------------------------------#
  41. # Vesta #
  42. #----------------------------------------------------------#
  43. # Logging
  44. log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_exp"
  45. log_event 'system' "$V_EVENT"
  46. exit