mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-03 04:00:20 -08:00
55 lines
1.5 KiB
Bash
Executable File
55 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: update domains disk usage
|
|
# options: USER
|
|
#
|
|
# The function recalculates disk usage for all user webdomains.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
|
|
# Includes
|
|
source $VESTA/func/main.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"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Domain loop
|
|
for domain in $(search_objects 'web' 'SUSPENDED' "no" 'DOMAIN'); do
|
|
home_dir="$HOMEDIR/$user/web/$domain/"
|
|
if [ -e "$home_dir" ]; then
|
|
disk_usage=$(nice -n 19 du -shm $home_dir | cut -f 1 )
|
|
fi
|
|
update_object_value 'web' 'DOMAIN' "$domain" '$U_DISK' "$disk_usage"
|
|
done
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Recalculating user disk space
|
|
recalc_user_disk_usage
|
|
|
|
# Logging
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|