v_unsuspend_web_domains 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/bash
  2. # info: unsuspening web domain (with ssl)
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user="$1"
  8. # Importing variables
  9. source $VESTA/conf/vars.conf
  10. source $V_FUNC/shared_func.sh
  11. source $V_FUNC/domain_func.sh
  12. #----------------------------------------------------------#
  13. # Verifications #
  14. #----------------------------------------------------------#
  15. # Checking arg number
  16. check_args '1' "$#" 'user'
  17. # Checking argument format
  18. format_validation 'user'
  19. # Checking web system is enabled
  20. is_system_enabled 'web'
  21. # Checking user
  22. is_user_valid
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Defining config
  27. conf="$V_USERS/$user/web_domains.conf"
  28. # Defining fileds to select
  29. field='$DOMAIN'
  30. # Defining search string
  31. search_string="SUSPEND='yes'"
  32. # Parsing suspeneded domains
  33. domains=$(dom_clear_search)
  34. # Starting unsuspend loop
  35. for domain in $domains; do
  36. # Get template name
  37. tpl_name=$(get_web_domain_value '$TPL')
  38. tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
  39. # Defining config
  40. conf="$V_HOME/$user/conf/httpd.conf"
  41. # Defining search phrase
  42. search_phrase='Redirect / '
  43. # Defining replace string
  44. str_repl=" DocumentRoot $V_HOME/$user/domains/$domain/public_html"
  45. # Unsuspending vhost
  46. change_web_config
  47. # Check ssl vhost
  48. cert=$(get_web_domain_value '$SSL_CERT')
  49. if [ ! -z "$cert" ]; then
  50. # Defining teplate name and ssl documentroot option
  51. tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
  52. tpl_opt=$(get_web_domain_value '$SSL_HOME')
  53. # Defining config
  54. conf="$V_HOME/$user/conf/shttpd.conf"
  55. # Switching on option
  56. case $tpl_opt in
  57. single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
  58. *) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
  59. esac
  60. # Defining replace string
  61. str_repl=" DocumentRoot $docroot"
  62. # Unsuspending vhost
  63. change_web_config
  64. fi
  65. # Adding unsuspend in config
  66. update_web_domain_value '$SUSPEND' 'no'
  67. done
  68. #----------------------------------------------------------#
  69. # Vesta #
  70. #----------------------------------------------------------#
  71. # Adding task to the vesta pipe
  72. restart_schedule 'web'
  73. # Logging
  74. log_event 'system' "$V_EVENT"
  75. exit $OK