2013-01-19 23:07:26 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
# info: list database servers
|
|
|
|
|
# options: TYPE [FORMAT]
|
|
|
|
|
#
|
|
|
|
|
# The function for obtaining the list of all hosts of the same databases' type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Variable&Function #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
2015-11-06 17:38:58 +02:00
|
|
|
# Argument definition
|
2013-10-25 21:40:13 +03:00
|
|
|
type=${1-mysql}
|
2013-01-19 23:07:26 +02:00
|
|
|
format=${2-shell}
|
|
|
|
|
|
|
|
|
|
# Includes
|
|
|
|
|
source $VESTA/func/main.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Verifications #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
# Checking args
|
2013-10-25 21:40:13 +03:00
|
|
|
#check_args '1' "$#" 'TYPE [FORMAT]'
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Action #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
# Defining fileds to select
|
|
|
|
|
conf=$VESTA/conf/$type.conf
|
2013-03-27 01:16:14 +02:00
|
|
|
fields='$HOST $CHARSETS $MAX_DB $U_SYS_USERS $U_DB_BASES $TPL $SUSPENDED'
|
2013-01-19 23:07:26 +02:00
|
|
|
fields="$fields \$TIME \$DATE"
|
|
|
|
|
|
|
|
|
|
# Listing database
|
|
|
|
|
case $format in
|
|
|
|
|
json) json_list ;;
|
|
|
|
|
plain) nohead=1; shell_list;;
|
2013-03-27 01:16:14 +02:00
|
|
|
shell) fields='$HOST $MAX_DB $U_DB_BASES $SUSPENDED $DATE';
|
2013-01-19 23:07:26 +02:00
|
|
|
shell_list | column -t ;;
|
|
|
|
|
*) check_args '2' '0' 'TYPE [FORMAT]'
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
# Vesta #
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
exit
|