myvesta/bin/v-update-web-domains-stat
2016-06-09 16:55:35 +03:00

53 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# info: update domains statistics
# options: USER
#
# The function runs log analyzer usage for all user webdomains.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/func/domain.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
is_format_valid 'user'
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Starting upd loop
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
get_domain_values 'web'
if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
$BIN/v-update-web-domain-stat "$user" "$domain"
fi
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit