v_add_web_domain_elog 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # info: adding 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_FUNC/shared_func.sh
  13. source $V_FUNC/domain_func.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking arg number
  18. check_args '2' "$#" 'user domain'
  19. # Checking argument format
  20. format_validation 'user' 'domain'
  21. # Checking web system is enabled
  22. is_system_enabled 'web'
  23. # Checking user
  24. is_user_valid
  25. # Checking user is active
  26. is_user_suspended
  27. # Checking domain exist
  28. is_web_domain_valid
  29. # Checking domain is not suspened
  30. is_domain_suspended 'web_domains'
  31. # Checking errorlog is not added
  32. is_web_domain_key_empty '$ELOG'
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Get template name
  37. tpl_name=$(get_web_domain_value '$TPL')
  38. tpl_file="$V_WEBTPL/apache_$tpl_name.tpl"
  39. # Defining config
  40. conf="$V_HOME/$user/conf/httpd.conf"
  41. # Defining search phrase
  42. search_phrase='ErrorLog '
  43. # Defining replace string
  44. str_repl=" ErrorLog /var/log/httpd/domains/$domain.error.log"
  45. # Adding errolog support
  46. change_web_config
  47. # Checking ssl
  48. cert=$(get_web_domain_value '$SSL_CERT')
  49. if [ ! -z "$cert" ]; then
  50. # Get ssl template name
  51. tpl_file="$V_WEBTPL/apache_$tpl_name.stpl"
  52. # Defining ssl config
  53. conf="$V_HOME/$user/conf/shttpd.conf"
  54. # Adding errolog support
  55. change_web_config
  56. fi
  57. #----------------------------------------------------------#
  58. # Vesta #
  59. #----------------------------------------------------------#
  60. # Adding elog in config
  61. update_web_domain_value '$ELOG' 'yes'
  62. # Adding task to the vesta pipe
  63. restart_schedule 'web'
  64. # Logging
  65. log_history "$V_EVENT" "v_del_web_domain_elog $user $domain"
  66. log_event 'system' "$V_EVENT"
  67. exit $OK