v_unsuspend_db_bases 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. # info: Unsuspending databses
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. user=$1
  8. # Importing variables
  9. source $VESTA/conf/vars.conf
  10. source $V_CONF/vesta.conf
  11. source $V_FUNC/shared.func
  12. source $V_FUNC/db.func
  13. #----------------------------------------------------------#
  14. # Verifications #
  15. #----------------------------------------------------------#
  16. # Checking arg number
  17. check_args '1' "$#" 'user'
  18. # Checking argument format
  19. format_validation 'user'
  20. # Checking db system is enabled
  21. is_system_enabled 'db'
  22. # Checking user
  23. is_user_valid
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Defining config
  28. conf="$V_USERS/$user/db.conf"
  29. # Defining fileds to select
  30. field='$DB'
  31. # Defining search string
  32. search_string="SUSPEND='yes'"
  33. # Parsing unsuspeneded domains
  34. databases=$(db_clear_search)
  35. for database in $databases; do
  36. # Define database variables
  37. db_user=$(get_db_value '$USER')
  38. host=$(get_db_value '$HOST')
  39. type=$(get_db_value '$TYPE')
  40. # Switching on db type
  41. case $type in
  42. mysql) unsuspend_db_mysql ;;
  43. pgsql) unsuspend_db_pgsql ;;
  44. esac
  45. # Updating db value
  46. update_db_base_value '$SUSPEND' 'no'
  47. done
  48. #----------------------------------------------------------#
  49. # Vesta #
  50. #----------------------------------------------------------#
  51. # Logging
  52. log_event 'system' "$V_EVENT"
  53. exit