v-rebuild-databases 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # info: rebuild databases
  3. # options: user
  4. #
  5. # The function for rebuilding 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. source $VESTA/func/db.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. check_args '1' "$#" 'user'
  19. validate_format 'user'
  20. is_system_enabled "$DB_SYSTEM"
  21. is_object_valid 'user' 'USER' "$user"
  22. #----------------------------------------------------------#
  23. # Action #
  24. #----------------------------------------------------------#
  25. # Starting rebuild loop
  26. for database in $(search_objects 'db' 'SUSPENDED' "no" 'DB'); do
  27. get_database_values
  28. # Switching on db type
  29. case $TYPE in
  30. mysql) rebuild_mysql_database ;;
  31. pgsql) rebuild_pgsql_database ;;
  32. esac
  33. done
  34. #----------------------------------------------------------#
  35. # Vesta #
  36. #----------------------------------------------------------#
  37. # Logging
  38. log_event "$OK" "$EVENT"
  39. exit