| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!/bin/bash
- # info: update databases disk usage
- # options: USER
- #
- # example: v-update-databases-disk admin
- #
- # This function recalculates disk usage for all user databases.
- #----------------------------------------------------------#
- # Variables & Functions #
- #----------------------------------------------------------#
- # Argument definition
- user=$1
- # Includes
- # shellcheck source=/etc/hestiacp/hestia.conf
- source /etc/hestiacp/hestia.conf
- # shellcheck source=/usr/local/hestia/func/main.sh
- source $HESTIA/func/main.sh
- # load config file
- source_conf "$HESTIA/conf/hestia.conf"
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- check_args '1' "$#" 'USER'
- is_format_valid 'user'
- is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
- is_object_valid 'user' 'USER' "$user"
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Starting update loop
- for database in $($BIN/v-list-databases $user plain | cut -f 1); do
- $BIN/v-update-database-disk "$user" "$database"
- done
- #----------------------------------------------------------#
- # Hestia #
- #----------------------------------------------------------#
- # Logging
- log_event "$OK" "$ARGUMENTS"
- exit
|