Commit 039c5f04 authored by iSergio's avatar iSergio
Browse files

Rename categories

parent 90f9bbb9
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -12,10 +12,10 @@ fi

TYPE=primary
VERBOSE=false
CATEGORY=a
CATEGORY=A
DB_CLUSTER=false

usage="$(basename "$0") [-h] [-p|s] [-a|b] [-d] -- Script configure pgpool-II
usage="$(basename "$0") [-h] [-p|s] [-A|B] [-d] -- Script configure pgpool-II
 where:
     -h  show this help text and exit
     -p  configure pgpool as primary
@@ -24,15 +24,15 @@ usage="$(basename "$0") [-h] [-p|s] [-a|b] [-d] -- Script configure pgpool-II
     -b  configure pgpool for category B (2 servers) (jboss and postgresql cluster on same hasts) (Default: a)
     -d  configure pgpool for PostgreSQL cluster (Default: false)
 Example usage:
    configure.sh -p -a    -- PgPool will be configured for primary server Category A without PostgreSQL (app-primary)
    configure.sh -s -a    -- PgPool will be configured for primary server Category A without PostgreSQL (app-standby)
    configure.sh -p -a -d -- PgPool will be configured for primary server Category A with PostgreSQL (db-primary)
    configure.sh -s -a -d -- PgPool will be configured for primary server Category A with PostgreSQL (db-standby)
    configure.sh -p -b    -- PgPool will be configured for primary server Category B with PostgreSQL (primary)
    configure.sh -s -b    -- PgPool will be configured for primary server Category B with PostgreSQL (standby)
    configure.sh -A -p    -- PgPool will be configured for primary server Category A without PostgreSQL (app-primary)
    configure.sh -A -s    -- PgPool will be configured for primary server Category A without PostgreSQL (app-standby)
    configure.sh -A -p -d -- PgPool will be configured for primary server Category A with PostgreSQL (db-primary)
    configure.sh -A -s -d -- PgPool will be configured for primary server Category A with PostgreSQL (db-standby)
    configure.sh -B -p    -- PgPool will be configured for primary server Category B with PostgreSQL (primary)
    configure.sh -B -s    -- PgPool will be configured for primary server Category B with PostgreSQL (standby)
"

while getopts ':psvhabd' option; do
while getopts ':psvhABd' option; do
    case "$option" in
        p) TYPE=primary
            ;;
@@ -40,9 +40,9 @@ while getopts ':psvhabd' option; do
            ;;
        v) VERBOSE=true
            ;;
        a) CATEGORY=a
        A) CATEGORY=A
            ;;
        b) CATEGORY=b
        B) CATEGORY=B
           DB_CLUSTER=true
            ;;
        d) DB_CLUSTER=true
@@ -67,7 +67,7 @@ if [[ ! -z $_TYPE ]]; then
    TYPE=$_TYPE
fi

if [[ $DB_CLUSTER == false && "$CATEGORY" == "a" ]]; then
if [[ $DB_CLUSTER == false && "$CATEGORY" == "A" ]]; then
    PGPOOL_PRIMARY_HOST=$JBOSS_PRIMARY_HOST
    PGPOOL_STANDBY_HOST=$JBOSS_STANDBY_HOST
fi
+8 −3
Original line number Diff line number Diff line
@@ -227,21 +227,26 @@ if [ $# -lt 1 ]; then
    exit 1
fi

CONFIGURE=false

while getopts ':hcst' option; do
    case "$option" in
        h) echo "$usage"
            exit
            ;;
        c) configure
            exit
            ;;
        s) status
            ;;
        t) PGTUNE=true
            ;;
        c) CONFIGURE=true
            ;;
        \?) printf "illegal option: -%s\n" "$OPTARG" >&2
            echo "$usage" >&2
            exit 1
            ;;
    esac
done

if [[ "$CONFIGURE" == true ]]; then
    configure
fi
+1 −1
Original line number Diff line number Diff line
@@ -97,5 +97,5 @@ sed -i 's/__PGPOOL_STANDBY_HOST__/'$PGPOOL_STANDBY_HOST'/g' /usr/local/bin/pg_re
cp -rf tsearch_data/* /usr/share/pgsql/tsearch_data/

if [[ "$TYPE" == "primary" ]]; then
    pg_replication -c
    pg_replication -c -t
fi