v_unsuspend_web_domain 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. # info: unsuspening web domain (with ssl)
  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 'web'
  23. # Checking user
  24. is_user_valid
  25. # Checking domain exist
  26. is_web_domain_valid
  27. # Check domain is suspened
  28. is_domain_unsuspended 'web_domains'
  29. #----------------------------------------------------------#
  30. # Action #
  31. #----------------------------------------------------------#
  32. # Get template name
  33. tpl_name=$(get_web_domain_value '$TPL')
  34. tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
  35. # Defining config
  36. conf="$V_HOME/$user/conf/httpd.conf"
  37. # Defining search phrase
  38. search_phrase='Redirect / '
  39. # Defining replace string
  40. str_repl=" DocumentRoot $V_HOME/$user/domains/$domain/public_html"
  41. # Unsuspending vhost
  42. change_web_config
  43. # Check ssl vhost
  44. cert=$(get_web_domain_value '$SSL_CERT')
  45. if [ ! -z "$cert" ]; then
  46. # Defining teplate name and ssl documentroot option
  47. tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
  48. tpl_option=$(get_web_domain_value '$SSL_HOME')
  49. # Defining config
  50. conf="$V_HOME/$user/conf/shttpd.conf"
  51. # Switching on option
  52. case $tpl_option in
  53. single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
  54. *) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
  55. esac
  56. # Defining replace string
  57. str_repl=" DocumentRoot $docroot"
  58. # Unsuspending vhost
  59. change_web_config
  60. fi
  61. #----------------------------------------------------------#
  62. # Vesta #
  63. #----------------------------------------------------------#
  64. # Adding suspend in config
  65. update_web_domain_value '$SUSPEND' 'no'
  66. # Adding task to the vesta pipe
  67. restart_schedule 'web'
  68. # Logging
  69. log_event 'system' "$V_EVENT"
  70. exit $OK