v_update_web_domains_stat 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/bash
  2. # info: update domains statistics
  3. # options: user
  4. #
  5. # The function runs log analyzer usage for all user webdomains.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_CONF/vesta.conf
  14. source $V_FUNC/shared.func
  15. source $V_FUNC/domain.func
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. # Checking arg number
  20. check_args '1' "$#" 'user'
  21. # Checking argument format
  22. format_validation 'user'
  23. # Checking web system is enabled
  24. is_system_enabled 'web'
  25. # Checking user
  26. is_user_valid
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Defining fileds to select
  31. field='$DOMAIN'
  32. conf="$V_USERS/$user/web.conf"
  33. search_string="SUSPEND='no'"
  34. # Parsing domain list
  35. domains=$(dom_clear_search)
  36. # Starting upd loop
  37. for domain in $domains; do
  38. stats=$(get_web_domain_value '$STATS')
  39. if [ ! -z "$stats" ]; then
  40. $V_BIN/v_update_web_domain_stat "$user" "$domain"
  41. rv="$?"
  42. if [ "$rv" -ne '0' ]; then
  43. log_event 'debug' "$rv $V_EVENT"
  44. exit $rv
  45. fi
  46. fi
  47. done
  48. #----------------------------------------------------------#
  49. # Vesta #
  50. #----------------------------------------------------------#
  51. # Logging
  52. log_event 'system' "$V_EVENT"
  53. exit