Skip to content

Commit 6d8ffc1

Browse files
committed
reset bw counter on the start of the month
1 parent 636213f commit 6d8ffc1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

bin/v-update-user-stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TOTAL_U_CRON_JOBS=0
6565
TOTAL_U_BACKUPS=0
6666

6767
# Updating user stats
68-
for user in $user_list; do
68+
for user in $user_list; do
6969
USER_DATA=$VESTA/data/users/$user
7070
source $USER_DATA/user.conf
7171
next_month=$(date +'%m/01/%y' -d '+ 1 month')

bin/v-update-web-domain-traff

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ echo > $log_file
6161
# Vesta #
6262
#----------------------------------------------------------#
6363

64+
# Reset counter on the start of the month
65+
if [ "$(date +%d)" = '01' ]; then
66+
update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' '0'
67+
fi
68+
6469
# Parsing old value
6570
get_domain_values 'web'
6671

bin/v-update-web-domains-traff

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ is_object_valid 'user' 'USER' "$user" "$user"
3333
#----------------------------------------------------------#
3434

3535
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
36+
# Reset BW counter on the start of the month
37+
if [ "$(date +%d)" = '01' ]; then
38+
update_object_value 'web' 'DOMAIN' "$domain" '$U_BANDWIDTH' '0'
39+
fi
40+
3641
log_file="/var/log/httpd/domains/$domain.bytes"
3742
bytes=0
3843

0 commit comments

Comments
 (0)