v_list_db_hosts 1.5 KB

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