v_delete_db_host 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # info: delete database serve
  3. # options: type host
  4. #
  5. # The function for deleting the database host from vesta configuration. It will
  6. # be deleted if there are no databases created on it only.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument defenition
  11. type=$1
  12. host=$2
  13. # Importing variables
  14. source $VESTA/conf/vars.conf
  15. source $V_CONF/vesta.conf
  16. source $V_FUNC/shared.func
  17. source $V_FUNC/db.func
  18. #----------------------------------------------------------#
  19. # Verifications #
  20. #----------------------------------------------------------#
  21. # Checking arg number
  22. check_args '2' "$#" 'type host'
  23. # Checking argument format
  24. format_validation 'host'
  25. # Checking db system is enabled
  26. is_system_enabled 'db'
  27. # Checking db type
  28. is_type_valid 'db' "$type"
  29. # Checking host existance
  30. is_db_host_valid
  31. # Checking db host users
  32. is_db_host_free
  33. #----------------------------------------------------------#
  34. # Action #
  35. #----------------------------------------------------------#
  36. # Deleting host from conf
  37. del_dbhost_vesta
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. # Logging
  42. log_event 'system' "$V_EVENT"
  43. exit