Files
VestaCP/bin/v-update-databases-disk

48 lines
1.2 KiB
Plaintext
Raw Normal View History

2011-06-14 00:22:25 +03:00
#!/bin/bash
2012-03-27 23:08:44 +03:00
# info: update databases disk usage
2012-01-03 21:48:46 +02:00
# options: user
2011-12-26 16:22:43 +02:00
#
2012-03-27 23:08:44 +03:00
# The function recalculates disk usage for all user databases.
2011-12-26 16:22:43 +02:00
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
2011-11-01 12:27:45 +02:00
user=$1
2011-06-14 00:22:25 +03:00
2012-04-02 15:17:28 +03:00
# Includes
2012-03-06 22:07:06 +02:00
source $VESTA/conf/vesta.conf
2012-04-30 12:32:11 +03:00
source $VESTA/func/main.sh
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'user'
2012-03-06 22:07:06 +02:00
validate_format 'user'
2012-03-27 23:08:44 +03:00
is_system_enabled "$DB_SYSTEM"
2012-03-06 22:07:06 +02:00
is_object_valid 'user' 'USER' "$user"
2011-06-14 00:22:25 +03:00
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
2012-03-27 23:08:44 +03:00
# Starting update loop
for database in $(search_objects 'db' 'SUSPENDED' "no" 'DB'); do
$BIN/v-update-database-disk "$user" "$database"
2011-06-14 00:22:25 +03:00
done
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
2012-03-06 22:07:06 +02:00
log_event "$OK" "$EVENT"
2011-06-14 00:22:25 +03:00
2011-11-01 12:27:45 +02:00
exit