v_change_dns_domain_soa 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # info: change dns domain soa record
  3. # options: user domain soa
  4. #
  5. # The function for changing SOA record. This type of records can not be
  6. # modified by v_change_dns_domain_record call.
  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. soa=$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 soa'
  25. # Checking argument format
  26. format_validation 'user' 'domain' 'soa'
  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 soa
  41. old_soa=$(get_dns_domain_value '$SOA')
  42. # Changing soa
  43. update_dns_domain_value '$SOA' "$soa"
  44. # Updating zone
  45. update_domain_zone
  46. #----------------------------------------------------------#
  47. # Vesta #
  48. #----------------------------------------------------------#
  49. # Adding task to the vesta pipe
  50. restart_schedule 'dns'
  51. # Logging
  52. log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_soa"
  53. log_event 'system' "$V_EVENT"
  54. exit