v-suspend-database-host 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # info: suspend database server
  3. # options: TYPE HOST
  4. # labels: panel
  5. #
  6. # example: v-suspend-database-host mysql localhost
  7. #
  8. # The function for suspending a database server.
  9. #----------------------------------------------------------#
  10. # Variable&Function #
  11. #----------------------------------------------------------#
  12. # Argument definition
  13. type=$1
  14. host=$2
  15. # Includes
  16. # shellcheck source=/usr/local/hestia/func/main.sh
  17. source $HESTIA/func/main.sh
  18. # shellcheck source=/usr/local/hestia/conf/hestia.conf
  19. source $HESTIA/conf/hestia.conf
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. check_args '2' "$#" 'TYPE HOST'
  24. is_format_valid 'type' 'host'
  25. is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
  26. is_object_valid "../../conf/$type" 'HOST' "$host"
  27. is_object_unsuspended "../../conf/$type" 'HOST' "$host"
  28. # Perform verification if read-only mode is enabled
  29. check_hestia_demo_mode
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Suspend database creation on a server
  34. update_object_value "../../conf/$type" 'HOST' "$host" '$SUSPENDED' 'yes'
  35. #----------------------------------------------------------#
  36. # Hestia #
  37. #----------------------------------------------------------#
  38. # Logging
  39. log_event "$OK" "$ARGUMENTS"
  40. exit