mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-02-03 16:43:09 -08:00
67 lines
1.5 KiB
Bash
Executable File
67 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: list web statistics
|
|
# options: [FORMAT]
|
|
#
|
|
# The function for obtaining the list of web statistics analyzer.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument defenition
|
|
format=${1-shell}
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
# Json function
|
|
json_list_st() {
|
|
stats=$(echo "${STATS_SYSTEM//,/ } none")
|
|
st_counter=$(echo "$stats" | wc -w)
|
|
i=1
|
|
echo '['
|
|
for st in $stats; do
|
|
if [ "$i" -lt "$st_counter" ]; then
|
|
echo -e "\t\"$st\","
|
|
else
|
|
echo -e "\t\"$st\""
|
|
fi
|
|
(( ++i))
|
|
done
|
|
echo "]"
|
|
}
|
|
|
|
# Shell function
|
|
shell_list_st() {
|
|
stats=$(echo "none ${STATS_SYSTEM//,/ }")
|
|
if [ -z "$nohead" ]; then
|
|
echo "STATS"
|
|
echo "----------"
|
|
fi
|
|
for st in $stats; do
|
|
echo "$st"
|
|
done
|
|
}
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Listing domains
|
|
case $format in
|
|
json) json_list_st ;;
|
|
plain) nohead=1; shell_list_st ;;
|
|
shell) shell_list_st ;;
|
|
*) check_args '1' '0' '[FORMAT]' ;;
|
|
esac
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
exit
|