v-unsuspend-database 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # info: unsuspend database
  3. # options: USER DATABASE
  4. #
  5. # The function for unsuspending database.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. database=$2
  12. # Includes
  13. source $VESTA/func/main.sh
  14. source $VESTA/func/db.sh
  15. source $VESTA/conf/vesta.conf
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. check_args '2' "$#" 'USER DATABASE'
  20. is_format_valid 'user' 'database'
  21. is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
  22. is_object_valid 'user' 'USER' "$user"
  23. is_object_valid 'db' 'DB' "$database"
  24. is_object_suspended 'db' 'DB' "$database"
  25. #----------------------------------------------------------#
  26. # Action #
  27. #----------------------------------------------------------#
  28. # Get database values
  29. get_database_values
  30. # Switching on db type
  31. case $TYPE in
  32. mysql) unsuspend_mysql_database ;;
  33. pgsql) unsuspend_pgsql_database ;;
  34. esac
  35. #----------------------------------------------------------#
  36. # Vesta #
  37. #----------------------------------------------------------#
  38. # Updating db value
  39. update_object_value 'db' 'DB' "$database" '$SUSPENDED' 'no'
  40. decrease_user_value "$user" '$SUSPENDED_DB'
  41. # Logging
  42. log_event "$OK" "$ARGUMENTS"
  43. exit