v_unsuspend_web_domain 2.4 KB

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