v_unsuspend_db_base 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 defenition
  10. user=$1
  11. database=$2
  12. # Importing variables
  13. source $VESTA/conf/vars.conf
  14. source $V_CONF/vesta.conf
  15. source $V_FUNC/shared.func
  16. source $V_FUNC/db.func
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. # Checking arg number
  21. check_args '2' "$#" 'user db_name'
  22. # Checking argument format
  23. format_validation 'user' 'database'
  24. # Checking db system is enabled
  25. is_system_enabled 'db'
  26. # Checking user
  27. is_user_valid
  28. # Checking db existance
  29. is_db_valid
  30. # Checking db is active
  31. is_db_unsuspended
  32. #----------------------------------------------------------#
  33. # Action #
  34. #----------------------------------------------------------#
  35. # Define database variables
  36. db_user=$(get_db_value '$USER')
  37. host=$(get_db_value '$HOST')
  38. type=$(get_db_value '$TYPE')
  39. # Switching on db type
  40. case $type in
  41. mysql) unsuspend_db_mysql ;;
  42. pgsql) unsuspend_db_pgsql ;;
  43. esac
  44. #----------------------------------------------------------#
  45. # Vesta #
  46. #----------------------------------------------------------#
  47. # Updating db value
  48. update_db_base_value '$SUSPEND' 'no'
  49. # Logging
  50. log_event 'system' "$V_EVENT"
  51. exit