v_delete_web_domain_elog 2.7 KB

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