v-list-web-stats 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # info: list web statistics
  3. # options: [format]
  4. #
  5. # The function for obtaining the list of web statistics analyzer.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. format=${1-shell}
  11. # Includes
  12. source $VESTA/func/main.sh
  13. source $VESTA/conf/vesta.conf
  14. # Json function
  15. json_list_st() {
  16. stats=$(echo "${STATS_SYSTEM//,/ } none")
  17. st_counter=$(echo "$stats" | wc -w)
  18. i=1
  19. echo '['
  20. for st in $stats; do
  21. if [ "$i" -lt "$st_counter" ]; then
  22. echo -e "\t\"$st\","
  23. else
  24. echo -e "\t\"$st\""
  25. fi
  26. (( ++i))
  27. done
  28. echo "]"
  29. }
  30. # Shell function
  31. shell_list_st() {
  32. stats=$(echo "none ${STATS_SYSTEM//,/ }")
  33. if [ -z "$nohead" ]; then
  34. echo "STATS"
  35. echo "----------"
  36. fi
  37. for st in $stats; do
  38. echo "$st"
  39. done
  40. }
  41. #----------------------------------------------------------#
  42. # Action #
  43. #----------------------------------------------------------#
  44. # Listing domains
  45. case $format in
  46. json) json_list_st ;;
  47. plain) nohead=1; shell_list_st ;;
  48. shell) shell_list_st ;;
  49. *) check_args '1' '0' '[format]' ;;
  50. esac
  51. #----------------------------------------------------------#
  52. # Vesta #
  53. #----------------------------------------------------------#
  54. exit