v_delete_web_domain_elog 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_$NGINX.tpl"
  54. conf="$HOMEDIR/$user/conf/web/nginx.conf"
  55. del_web_config
  56. add_web_config
  57. if [ "$SSL" = 'yes' ]; then
  58. tpl_file="$WEBTPL/ngingx_$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. if [ "$restart" != 'no' ]; then
  71. $BIN/v_restart_web "$EVENT"
  72. fi
  73. # Logging
  74. log_history "$EVENT"
  75. log_event "$OK" "$EVENT"
  76. exit