v-update-databases-disk 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # info: update databases disk usage
  3. # options: USER
  4. #
  5. # example: v-update-databases-disk admin
  6. #
  7. # This function recalculates disk usage for all user databases.
  8. #----------------------------------------------------------#
  9. # Variables & Functions #
  10. #----------------------------------------------------------#
  11. # Argument definition
  12. user=$1
  13. # Includes
  14. # shellcheck source=/etc/hestiacp/hestia.conf
  15. source /etc/hestiacp/hestia.conf
  16. # shellcheck source=/usr/local/hestia/func/main.sh
  17. source $HESTIA/func/main.sh
  18. # load config file
  19. source_conf "$HESTIA/conf/hestia.conf"
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. check_args '1' "$#" 'USER'
  24. is_format_valid 'user'
  25. is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
  26. is_object_valid 'user' 'USER' "$user"
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Starting update loop
  31. for database in $($BIN/v-list-databases $user plain | cut -f 1); do
  32. $BIN/v-update-database-disk "$user" "$database"
  33. done
  34. #----------------------------------------------------------#
  35. # Hestia #
  36. #----------------------------------------------------------#
  37. # Logging
  38. log_event "$OK" "$ARGUMENTS"
  39. exit