mass stats update

This commit is contained in:
Serghey Rodin 2011-09-23 14:38:37 +03:00
commit cc6491ef34

70
bin/v_upd_web_domains_stat Executable file
View file

@ -0,0 +1,70 @@
#!/bin/bash
# info: updating web statistics for all domains
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user="$1"
# Importing variables
source $VESTA/conf/vars.conf
source $V_FUNC/shared_func.sh
source $V_FUNC/domain_func.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking arg number
check_args '1' "$#" 'user'
# Checking argument format
format_validation 'user'
# Checking web system is enabled
is_system_enabled 'web'
# Checking user
is_user_valid
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Defining config
conf="$V_USERS/$user/web.conf"
# Defining fileds to select
field='$DOMAIN'
# Defining search string
search_string="SUSPEND='no'"
# Parsing domain list
domains=$(dom_clear_search)
# Starting upd loop
for domain in $domains; do
stats=$(get_web_domain_value '$STATS')
if [ ! -z "$stats" ]; then
$V_BIN/v_upd_web_domain_stat "$user" "$domain"
rv="$?"
if [ "$rv" -ne '0' ]; then
log_event 'debug' "$rv $V_EVENT"
exit $rv
fi
fi
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event 'system' "$V_EVENT"
exit $OK