v_list_db_host 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # info: listing data base servers
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. type="$1"
  8. host="$2"
  9. format="${3-shell}"
  10. # Importing variables
  11. source $VESTA/conf/vars.conf
  12. source $V_FUNC/shared_func.sh
  13. source $V_FUNC/db_func.sh
  14. #----------------------------------------------------------#
  15. # Verifications #
  16. #----------------------------------------------------------#
  17. # Checking args
  18. check_args '2' "$#" 'type host [format]'
  19. # Checking argument format
  20. format_validation 'host'
  21. # Checking db type
  22. is_type_valid 'db' "$type"
  23. # Checking db host
  24. is_db_host_valid
  25. #----------------------------------------------------------#
  26. # Action #
  27. #----------------------------------------------------------#
  28. # Defining config type
  29. conf="$V_DB/$type.conf"
  30. # Defining fileds to select
  31. fields='$HOST $PORT $MAX_USERS $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
  32. # Listing database
  33. case $format in
  34. json) dbhost_json_single_list ;;
  35. shell) dbhost_shell_single_list | column -t;;
  36. *) check_args '2' "0" 'type host [format]'
  37. esac
  38. #----------------------------------------------------------#
  39. # Vesta #
  40. #----------------------------------------------------------#
  41. # Logging
  42. log_event 'system' "$V_EVENT"
  43. exit $OK