v_unsuspend_dns_domain 1.6 KB

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