| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #!/bin/bash
- # info: list postgresql config parameters
- # options: [FORMAT]
- # labels: panel
- #
- # The function for obtaining the list of postgresql config parameters.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument definition
- format=${1-shell}
- # Includes
- source $HESTIA/func/main.sh
- # JSON list function
- json_list() {
- echo '{
- "CONFIG": {
- "pg_hba_path": "'$pg_hba_path'",
- "config_path": "'$config_path'"
- }
- }'
- }
- # SHELL list function
- shell_list() {
- echo "config_path: $config_path"
- echo "pg_hba_path: $pg_hba_path"
- }
- # PLAIN list function
- plain_list() {
- echo -e "$config_path\t$pg_hba_path"
- }
- # CSV list function
- csv_list() {
- echo "config_path,pg_hba_path"
- echo "$config_path,$pg_hba_path"
- }
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Defining config path
- config_path=$(find /etc/postgresql /var/lib/pgsql/data -name \
- postgresql.conf 2>/dev/null)
- pg_hba_path=$(find /etc/postgresql /var/lib/pgsql/data -name \
- pg_hba.conf 2>/dev/null)
- # Listing data
- case $format in
- json) json_list ;;
- plain) plain_list ;;
- csv) csv_list ;;
- shell) shell_list;;
- esac
- #----------------------------------------------------------#
- # Hestia #
- #----------------------------------------------------------#
- exit
|