v_unsuspend_web_domain 2.3 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=$(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_CONF/vesta.conf
  13. source $V_FUNC/shared.func
  14. source $V_FUNC/domain.func
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking arg number
  19. check_args '2' "$#" 'user domain'
  20. # Checking argument format
  21. format_validation 'user' 'domain'
  22. # Checking web system is enabled
  23. is_system_enabled 'web'
  24. # Checking user
  25. is_user_valid
  26. # Checking domain exist
  27. is_web_domain_valid
  28. # Check domain is suspened
  29. is_domain_unsuspended 'web'
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Parsing domain values
  34. get_web_domain_values
  35. tpl_file="$V_WEBTPL/apache_$TPL.tpl"
  36. conf="$V_HOME/$user/conf/httpd.conf"
  37. SUSPEND='no'
  38. # Preparing domain values for the template substitution
  39. upd_web_domain_values
  40. # Recreating vhost
  41. del_web_config
  42. add_web_config
  43. # Check ssl
  44. if [ "$SSL" = 'yes' ]; then
  45. tpl_file="$V_WEBTPL/apache_$TPL.stpl"
  46. conf="$V_HOME/$user/conf/shttpd.conf"
  47. del_web_config
  48. add_web_config
  49. fi
  50. # Checking nginx
  51. if [ ! -z "$NGINX" ]; then
  52. tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
  53. conf="$V_HOME/$user/conf/nginx.conf"
  54. del_web_config
  55. add_web_config
  56. if [ "$SSL" = 'yes' ]; then
  57. proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
  58. tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
  59. conf="$V_HOME/$user/conf/snginx.conf"
  60. del_web_config
  61. add_web_config
  62. fi
  63. fi
  64. #----------------------------------------------------------#
  65. # Vesta #
  66. #----------------------------------------------------------#
  67. # Adding suspend in config
  68. update_web_domain_value '$SUSPEND' 'no'
  69. # Adding task to the vesta pipe
  70. restart_schedule 'web'
  71. # Logging
  72. log_event 'system' "$V_EVENT"
  73. exit