v_delete_web_domain_elog 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. # info: deleting error log for domain
  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 "$user"
  26. # Checking user is active
  27. is_user_suspended
  28. # Checking domain exist
  29. is_web_domain_valid
  30. # Checking domain is not suspened
  31. is_domain_suspended 'web'
  32. # Check errorlog is added
  33. is_web_domain_value_exist '$ELOG'
  34. #----------------------------------------------------------#
  35. # Action #
  36. #----------------------------------------------------------#
  37. # Parsing domain values
  38. get_web_domain_values
  39. tpl_file="$V_WEBTPL/apache_$TPL.tpl"
  40. conf="$V_HOME/$user/conf/httpd.conf"
  41. ELOG='no'
  42. # Preparing domain values for the template substitution
  43. upd_web_domain_values
  44. # Recreating vhost
  45. del_web_config
  46. add_web_config
  47. # Checking ssl
  48. if [ "$SSL" = 'yes' ]; then
  49. tpl_file="$V_WEBTPL/apache_$TPL.stpl"
  50. conf="$V_HOME/$user/conf/shttpd.conf"
  51. del_web_config
  52. add_web_config
  53. fi
  54. # Checking nginx
  55. if [ ! -z "$NGINX" ]; then
  56. tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
  57. conf="$V_HOME/$user/conf/nginx.conf"
  58. del_web_config
  59. add_web_config
  60. if [ "$SSL" = 'yes' ]; then
  61. proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
  62. tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
  63. conf="$V_HOME/$user/conf/snginx.conf"
  64. del_web_config
  65. add_web_config
  66. fi
  67. fi
  68. #----------------------------------------------------------#
  69. # Vesta #
  70. #----------------------------------------------------------#
  71. # Deleting elog in config
  72. update_web_domain_value '$ELOG' 'no'
  73. # Adding task to the vesta pipe
  74. restart_schedule 'web'
  75. # Logging
  76. log_history "$V_EVENT" "v_add_web_domain_elog $user $domain"
  77. log_event 'system' "$V_EVENT"
  78. exit