Browse Source

mass stats update

Serghey Rodin 14 years ago
parent
commit
cc6491ef34
1 changed files with 70 additions and 0 deletions
  1. 70 0
      bin/v_upd_web_domains_stat

+ 70 - 0
bin/v_upd_web_domains_stat

@@ -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