diff --git a/postgres/bin/pg_failover b/postgres/bin/pg_failover index 362a0c1278a83086557afa17e8effab972029267..3d05013bd59d9b118f642e3116a8ce0505c792b2 100755 --- a/postgres/bin/pg_failover +++ b/postgres/bin/pg_failover @@ -12,18 +12,17 @@ NEW_MASTER_DATA=${10} TRIGGER_FILE=${11} -printf "[DEBUG] -Node id: %d -Host name: %s -Port number: %d -Database cluster path: %s -New master node id: %d -Host name of the new master node: %s -Old master node id: %d -Old primary node id: %d -New master port number: %d -New master database cluster path: %s -Trigger file: %s\n" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" +printf "[DEBUG] Node id: %d +[DEBUG] Host name: %s +[DEBUG] Port number: %d +[DEBUG] Database cluster path: %s +[DEBUG] New master node id: %d +[DEBUG] Host name of the new master node: %s +[DEBUG] Old master node id: %d +[DEBUG] Old primary node id: %d +[DEBUG] New master port number: %d +[DEBUG] New master database cluster path: %s +[DEBUG] Trigger file: %s\n" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" if [ $NEW_MASTER_NODE_ID == $OLD_PRIMARY_NODE_ID ]; then echo "[INFO] Standby node is down. Failover not triggered!" diff --git a/postgres/bin/pg_recovery b/postgres/bin/pg_recovery index 827aa0466c689a5d7f60f35d6a013cddf462b104..88addf1bb5a22574b3756aa9f5e78ea8c63368d6 100755 --- a/postgres/bin/pg_recovery +++ b/postgres/bin/pg_recovery @@ -29,8 +29,14 @@ function recovery () { echo "[DEBUG]: Standby host: $STANDBY_HOST" if [[ $PRIMARY_HOST == $STANDBY_HOST ]]; then - echo "Somthing wrong with primary and standby host defined in configs. Can't continue recovery." - exit 1 + if [[ $# != 2 ]]; then + echo "Something wrong with primary and standby host defined in configs. Can't continue recovery." + echo "Try execute script with parameters: example - pg_recovery ip_master id_slave" + exit 1 + else + PRIMARY_HOST=$1 + STANDBY_HOST=$2 + fi fi # Stop primary database (not necessary(check))