v-update-databases-disk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. source $HESTIA/func/main.sh
  16. source $HESTIA/conf/hestia.conf
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. check_args '1' "$#" 'USER'
  21. is_format_valid 'user'
  22. is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
  23. is_object_valid 'user' 'USER' "$user"
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Starting update loop
  28. for database in $(search_objects 'db' 'SUSPENDED' "no" 'DB'); do
  29. $BIN/v-update-database-disk "$user" "$database"
  30. done
  31. #----------------------------------------------------------#
  32. # Hestia #
  33. #----------------------------------------------------------#
  34. # Logging
  35. log_event "$OK" "$ARGUMENTS"
  36. exit