v-update-databases-disk 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # info: update databases disk usage
  3. # options: USER
  4. # labels: panel
  5. #
  6. # example: v-update-databases-disk admin
  7. #
  8. # The function recalculates disk usage for all user databases.
  9. #----------------------------------------------------------#
  10. # Variable&Function #
  11. #----------------------------------------------------------#
  12. # Argument definition
  13. user=$1
  14. # Includes
  15. # shellcheck source=/usr/local/hestia/func/main.sh
  16. source $HESTIA/func/main.sh
  17. # shellcheck source=/usr/local/hestia/conf/hestia.conf
  18. source $HESTIA/conf/hestia.conf
  19. #----------------------------------------------------------#
  20. # Verifications #
  21. #----------------------------------------------------------#
  22. check_args '1' "$#" 'USER'
  23. is_format_valid 'user'
  24. is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
  25. is_object_valid 'user' 'USER' "$user"
  26. #----------------------------------------------------------#
  27. # Action #
  28. #----------------------------------------------------------#
  29. # Starting update loop
  30. for database in $(search_objects 'db' 'SUSPENDED' "no" 'DB'); do
  31. $BIN/v-update-database-disk "$user" "$database"
  32. done
  33. #----------------------------------------------------------#
  34. # Hestia #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_event "$OK" "$ARGUMENTS"
  38. exit