v_unsuspend_web_domain 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/bash
  2. # info: unsuspend web domain
  3. # options: user domain
  4. #
  5. # The function of unsuspending the domain.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. domain=$(idn -t --quiet -u "$2" )
  12. domain_idn=$(idn -t --quiet -a "$domain")
  13. # Importing variables
  14. source $VESTA/conf/vars.conf
  15. source $V_CONF/vesta.conf
  16. source $V_FUNC/shared.func
  17. source $V_FUNC/domain.func
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. # Checking arg number
  22. check_args '2' "$#" 'user domain'
  23. # Checking argument format
  24. format_validation 'user' 'domain'
  25. # Checking web system is enabled
  26. is_system_enabled 'web'
  27. # Checking user
  28. is_user_valid
  29. # Checking domain exist
  30. is_web_domain_valid
  31. # Check domain is suspened
  32. is_domain_unsuspended 'web'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Parsing domain values
  37. get_web_domain_values
  38. tpl_file="$V_WEBTPL/apache_$TPL.tpl"
  39. conf="$V_HOME/$user/conf/httpd.conf"
  40. SUSPEND='no'
  41. # Preparing domain values for the template substitution
  42. upd_web_domain_values
  43. # Recreating vhost
  44. del_web_config
  45. add_web_config
  46. # Check ssl
  47. if [ "$SSL" = 'yes' ]; then
  48. tpl_file="$V_WEBTPL/apache_$TPL.stpl"
  49. conf="$V_HOME/$user/conf/shttpd.conf"
  50. del_web_config
  51. add_web_config
  52. fi
  53. # Checking nginx
  54. if [ ! -z "$NGINX" ]; then
  55. tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
  56. conf="$V_HOME/$user/conf/nginx.conf"
  57. del_web_config
  58. add_web_config
  59. if [ "$SSL" = 'yes' ]; then
  60. proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
  61. tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
  62. conf="$V_HOME/$user/conf/snginx.conf"
  63. del_web_config
  64. add_web_config
  65. fi
  66. fi
  67. #----------------------------------------------------------#
  68. # Vesta #
  69. #----------------------------------------------------------#
  70. # Adding suspend in config
  71. update_web_domain_value '$SUSPEND' 'no'
  72. # Adding task to the vesta pipe
  73. restart_schedule 'web'
  74. # Logging
  75. log_event 'system' "$V_EVENT"
  76. exit