v_change_dns_domain_exp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. # Importing variables
  16. source $VESTA/conf/vars.conf
  17. source $V_CONF/vesta.conf
  18. source $V_FUNC/shared.func
  19. source $V_FUNC/domain.func
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. # Checking arg number
  24. check_args '3' "$#" 'user domain exp'
  25. # Checking argument format
  26. format_validation 'user' 'domain' 'exp'
  27. # Checking web system is enabled
  28. is_system_enabled 'dns'
  29. # Checking user
  30. is_user_valid
  31. # Checking user is active
  32. is_user_suspended
  33. # Checking domain exist
  34. is_dns_domain_valid
  35. # Checking domain is not suspened
  36. is_domain_suspended 'dns'
  37. #----------------------------------------------------------#
  38. # Action #
  39. #----------------------------------------------------------#
  40. # Get old expiriation date
  41. old_exp=$(get_dns_domain_value '$EXP')
  42. # Changing exp
  43. update_dns_domain_value '$EXP' "$exp"
  44. #----------------------------------------------------------#
  45. # Vesta #
  46. #----------------------------------------------------------#
  47. # Logging
  48. log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_exp"
  49. log_event 'system' "$V_EVENT"
  50. exit