v_unsuspend_dns_domain 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # info: unsuspening dns domain
  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. # Importing variables
  11. source $VESTA/conf/vars.conf
  12. source $V_CONF/vesta.conf
  13. source $V_FUNC/shared.func
  14. source $V_FUNC/domain.func
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking arg number
  19. check_args '2' "$#" 'user domain'
  20. # Checking argument format
  21. format_validation 'user' 'domain'
  22. # Checking web system is enabled
  23. is_system_enabled 'dns'
  24. # Checking user
  25. is_user_valid
  26. # Checking domain exist
  27. is_dns_domain_valid
  28. # Check domain is suspened
  29. is_domain_unsuspended 'dns'
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Defining config
  34. conf="/etc/named.conf"
  35. # Adding zone in named.conf
  36. nmd_rec="zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };"
  37. echo "$nmd_rec" >> $conf
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. # Unsuspending domain in config
  42. update_dns_domain_value '$SUSPEND' 'no'
  43. # Adding task to the vesta pipe
  44. restart_schedule 'dns'
  45. # Logging
  46. log_event 'system' "$V_EVENT"
  47. exit