v_delete_web_domain_elog 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # info: delete web domain error loggin support
  3. # options: user domain [restart]
  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. restart=$3
  16. # Includes
  17. source $VESTA/conf/vesta.conf
  18. source $VESTA/func/main.sh
  19. source $VESTA/func/domain.sh
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. check_args '2' "$#" 'user domain [restart]'
  24. validate_format 'user' 'domain'
  25. is_system_enabled "$WEB_SYSTEM"
  26. is_object_valid 'user' 'USER' "$user" "$user"
  27. is_object_unsuspended 'user' 'USER' "$user"
  28. is_object_valid 'web' 'DOMAIN' "$domain"
  29. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  30. is_object_value_exist 'web' 'DOMAIN' "$domain" '$ELOG'
  31. #----------------------------------------------------------#
  32. # Action #
  33. #----------------------------------------------------------#
  34. # Parsing domain values
  35. get_domain_values 'web'
  36. tpl_file="$WEBTPL/apache_$TPL.tpl"
  37. conf="$HOMEDIR/$user/conf/web/httpd.conf"
  38. ELOG='no'
  39. # Preparing domain values for the template substitution
  40. upd_web_domain_values
  41. # Recreating vhost
  42. del_web_config
  43. add_web_config
  44. # Checking ssl
  45. if [ "$SSL" = 'yes' ]; then
  46. tpl_file="$WEBTPL/apache_$TPL.stpl"
  47. conf="$HOMEDIR/$user/conf/web/shttpd.conf"
  48. del_web_config
  49. add_web_config
  50. fi
  51. # Checking nginx
  52. if [ ! -z "$NGINX" ]; then
  53. tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
  54. conf="$HOMEDIR/$user/conf/web/nginx.conf"
  55. del_web_config
  56. add_web_config
  57. if [ "$SSL" = 'yes' ]; then
  58. proxy_string="proxy_pass https://$ip:$WEB_SSL_PORT;"
  59. tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
  60. conf="$HOMEDIR/$user/conf/web/snginx.conf"
  61. del_web_config
  62. add_web_config
  63. fi
  64. fi
  65. #----------------------------------------------------------#
  66. # Vesta #
  67. #----------------------------------------------------------#
  68. # Update config
  69. update_object_value 'web' 'DOMAIN' "$domain" '$ELOG' 'no'
  70. # Restart web server
  71. if [ "$restart" != 'no' ]; then
  72. $BIN/v_restart_web "$EVENT"
  73. fi
  74. # Logging
  75. log_history "$EVENT"
  76. log_event "$OK" "$EVENT"
  77. exit