v-suspend-databases 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # info: suspend databases
  3. # options: user
  4. #
  5. # The function for suspending of all databases of a single user.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. # Includes
  12. source $VESTA/conf/vesta.conf
  13. source $VESTA/func/main.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. check_args '1' "$#" 'user'
  18. validate_format 'user'
  19. is_system_enabled "$DB_SYSTEM"
  20. is_object_valid 'user' 'USER' "$user"
  21. #----------------------------------------------------------#
  22. # Action #
  23. #----------------------------------------------------------#
  24. # Starting suspend loop
  25. for database in $(search_objects 'db' 'SUSPENDED' "no" 'DB'); do
  26. $BIN/v-suspend-database "$user" "$database"
  27. done
  28. #----------------------------------------------------------#
  29. # Vesta #
  30. #----------------------------------------------------------#
  31. # Logging
  32. log_event "$OK" "$EVENT"
  33. exit