v_delete_web_domain_elog 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. # Includes
  16. source $VESTA/conf/vesta.conf
  17. source $VESTA/func/main.sh
  18. source $VESTA/func/domain.sh
  19. #----------------------------------------------------------#
  20. # Verifications #
  21. #----------------------------------------------------------#
  22. check_args '2' "$#" 'user domain'
  23. validate_format 'user' 'domain'
  24. is_system_enabled "$WEB_SYSTEM"
  25. is_object_valid 'user' 'USER' "$user" "$user"
  26. is_object_unsuspended 'user' 'USER' "$user"
  27. is_object_valid 'web' 'DOMAIN' "$domain"
  28. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  29. is_object_value_exist 'web' 'DOMAIN' "$domain" '$ELOG'
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Parsing domain values
  34. get_domain_values 'web'
  35. tpl_file="$WEBTPL/apache_$TPL.tpl"
  36. conf="$HOMEDIR/$user/conf/web/httpd.conf"
  37. ELOG='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. # Checking ssl
  44. if [ "$SSL" = 'yes' ]; then
  45. tpl_file="$WEBTPL/apache_$TPL.stpl"
  46. conf="$HOMEDIR/$user/conf/web/shttpd.conf"
  47. del_web_config
  48. add_web_config
  49. fi
  50. # Checking nginx
  51. if [ ! -z "$NGINX" ]; then
  52. tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
  53. conf="$HOMEDIR/$user/conf/web/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="$WEBTPL/ngingx_vhost_$NGINX.stpl"
  59. conf="$HOMEDIR/$user/conf/web/snginx.conf"
  60. del_web_config
  61. add_web_config
  62. fi
  63. fi
  64. #----------------------------------------------------------#
  65. # Vesta #
  66. #----------------------------------------------------------#
  67. # Update config
  68. update_object_value 'web' 'DOMAIN' "$domain" '$ELOG' 'no'
  69. # Restart web server
  70. $BIN/v_restart_web "$EVENT"
  71. # Logging
  72. log_history "$EVENT"
  73. log_event "$OK" "$EVENT"
  74. exit