-#! /bin/sh
+#!/bin/bash
# Online recovery 2nd stage script
-#
+
+set -o xtrace
+
DATADIR=$1 # main dabatase cluster
DEST=$2 # hostname of the DB node to be recovered
DESTDIR=$3 # database cluster of the DB node to be recovered
PORT=$4 # PostgreSQL port number
-PGHOME=/usr/pgsql-11
+PGHOME=/usr/pgsql-13
ARCHIVEDIR=/var/lib/pgsql/archivedir # archive log directory
-# Force to flush current value of sequences to xlog
+# Force to flush current value of sequences to xlog
${PGHOME}/bin/psql -p $PORT -t -c 'SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn' template1|
while read i
do