Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbzoG-0005Ob-Id for pgsql-admin@arkaria.postgresql.org; Mon, 09 Nov 2020 05:33:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kbzoF-0003fg-Gz for pgsql-admin@arkaria.postgresql.org; Mon, 09 Nov 2020 05:33:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kbzoE-0003fX-F4 for pgsql-admin@lists.postgresql.org; Mon, 09 Nov 2020 05:33:43 +0000 Received: from cloudearth.serversfarm.com ([216.244.65.90]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kbzo6-0000q6-I2 for pgsql-admin@lists.postgresql.org; Mon, 09 Nov 2020 05:33:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ibosstech-us.com; s=x; h=Content-Type:Mime-Version:Reply-To:References: In-Reply-To:Message-Id:Date:Cc:Subject:To:From:Sender: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aL5jm8hACRToptl8+LE4XeQ8xoJhq//xg5iBt/QR/fc=; b=oC94BTrk59avAf8TEWH3Duw3R CKtCs1WognOoRH3L0q+rqWe/KBZlh20YFMMAXkFMvVcQI6irWbbU1UkrTexzgneXxoC949kz8GGOX mrbXe7qKH2armVvP/8HGKHzyE2dSvnrMR+mzK4ZdPAKakLHJdZ0KdPfkla0dr0XD4+P/mjllpBvsw ceHk3NXKR3dyd7KwrdTkPKAJ9+ExjvhlLGN1BCZgt6ClYe/8cnT99occCZQSNN9h5CVxwSLx372jp pwy1tOTo63AWTUsLubeBXOs8XAakUktNb2gv4LVeB8fUa9wazqZ0IobpBhW8FZ/YZq/VTXjza/Q+s FyA0soYfg==; Received: from [106.212.128.18] (helo=[192.168.1.10]) by cloudearth.serversfarm.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kbzo4-000cVg-A1; Mon, 09 Nov 2020 00:33:33 -0500 From: "Anjul Tyagi" To: "Avinash Kumar" , "Walters Che Ndoh" Subject: Re: Backup restore for upgrade Cc: pgsql-admin@lists.postgresql.org Date: Mon, 09 Nov 2020 05:33:25 +0000 Message-Id: In-Reply-To: References: Reply-To: "Anjul Tyagi" User-Agent: eM_Client/8.0.3385.0 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MBB7170C12-C35A-48E2-B3C0-5177DD79CEF3" X-Authenticated-Id: anjul@ibosstech-us.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --------=_MBB7170C12-C35A-48E2-B3C0-5177DD79CEF3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable I suggest you can change the replica identity to Full and replicate the=20 data. you may see more walfiles as compare to now a days. Regards, Anjul TYAGI =C3=BC Go Green ------ Original Message ------ From: "Avinash Kumar" To: "Walters Che Ndoh" Cc: pgsql-admin@lists.postgresql.org Sent: 11/9/2020 12:37:21 AM Subject: Re: Backup restore for upgrade >Hi, > > >On Sun, Nov 8, 2020 at 2:22 AM Walters Che Ndoh =20 >wrote: >>Hi All, >> >>I am trying to upgrade one of my 1TB databases from pg9.5 to 10 and=20 >>having some troubles. >>First I tried using pglogical and it failed because most of the tables=20 >>didn't have a primary key. >>Second, i tried pg_upgrade and it also failed with some really weird=20 >>errors. >See if temporarily you could add a sequence column as a Primary key=20 >column to the list of tables without a primary key. If not see below. >> >>At this point, I am really convinced that the upgrade can only be=20 >>possible by me taking a dump of the old version and restore it in the=20 >>new version on a new server. >>So I am working on this script to help me take a dump from the old=20 >>version server and restore it into the pg10 server. >>I am trying to speed up the process using some jobs based on my cpu. >>The script doesn't work as intended...especially the restore part as=20 >>it just stops at the restore part. Maybe the dump format..?? >It will be great to see and understand the issue if you could share=20 >some error messages during restore. >However, see if you are using the binaries of the latest (target)=20 >version for both pg_dump and pg_restore. There can sometimes be=20 >challenges when you are using Older version binaries to perform the=20 >dump and restore. >> >>Please can someone help me review the script below maybe i am making=20 >>errors at defining the variables or at the function level. >>OR if you have a better script to recommend i will appreciate it. >> >>Thanks >> >>script >>-------------------------------------------------------------------------= ---------------------------------------------- >>#!/bin/bash >> >>jobs=3D6; >>mydate=3D$(date +"%Y%m%d%H%M%S"); >>env=3Dprod; >>dbname=3Dtest; >>rds_pguser=3Dtest_user; >>host=3Dlocalhost; >> >>backupDir=3D/var/lib/data/backup/`date +%Y-%m-%d`; >>sqlDir=3D${backupDir}/sql; >>logDir=3D${backupDir}/logs; >>backuproles=3D${backupDir}/globals-${env}-${mydate}.sql; >> >># Logs source instance >>roles_logs=3D${logDir}/roles_logs-${env}-${mydate}.log; >>pgdump_logs=3D${logDir}/pgdump_logs-${env}-${mydate}.log; >>restore_logs=3D${logDir}/restore_logs-${env}-${mydate}.log; >>process_log=3D${logDir}/process_log-${env}-${mydate}.log; >> >># RDS Target host >>target_rds_host=3D"IP of destination server"; >>rds_pguser=3Dtest_user; >>new_dbname=3Dtest; >>wait_in_seconds=3D1800; >> >>GREEN=3D"\033[32m"; BLUE=3D"\033[34m"; RED=3D"\033[31m"; RESET=3D"\033[0m= ";=20 >>YELLOW=3D"\033[33m"; >> >># Functions >>log() { >> local log_info=3D$1; >> if [[ "${log_info}" =3D=3D "INFO" ]]; then >> echo -e "${BLUE}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: =20 >>$2 ${RESET}"; >> echo -e "[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2" >>=20 >>${process_log}; >> elif [[ "${log_info}" =3D=3D "WARN" ]]; then >> echo -e "${YELLOW}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: = =20 >>$2 ${RESET}"; >> echo -e "[${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2" >>=20 >>${process_log}; >> elif [[ "${log_info}" =3D=3D "SUCC" ]]; then >> echo -e "${GREEN}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: =20 >>$2 ${RESET}"; >> echo -e "[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2" >>=20 >>${process_log}; >> elif [[ "${log_info}" =3D=3D "EXIT" ]]; then >> echo -e "${RED}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2= =20 >>${RESET}"; >> echo -e "[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2" >>=20 >>${process_log}; >> elif [[ "${log_info}" =3D=3D "ERROR" ]]; then >> echo -e "${RED}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2= =20 >>${RESET}"; >> echo -e "[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: $2" >>=20 >>${process_log}; >> fi >>} >> >>error_exit() { >> log "EXIT" "Exiting due to errors!"; >> #send_email "${body_mail_log}" "${status}" >> exit 1; >>} >> >>createLogFiles() { >> >> for file in ${roles_logs} ${pgdump_logs} ${restore_logs}=20 >>${process_log}; do >> touch ${file}; >> ret=3D$?; >> if [ ${ret} -ne 0 ]; then >> echo "ERROR: Unable to create file [${file}]: ${ret}"; >> exit 1; >> fi; >> done; >> >>} >> >>createDirs() { >> >> for dir in ${backupDir} ${logDir} ${sqlDir}; do >> if [[ ! -d "${dir}" ]]; then >> mkdir -p ${dir}; ret=3D$?; >> if [ ${ret} -ne 0 ]; then >> echo "ERROR: Failed creating directory [${dir}] failed:=20 >>${ret}"; >> exit 1; >> fi; >> fi; >> done; >> >>} >> >>dumpRoles() { >> >> log "INFO" "Start backing up PG-Roles." >> >> cmd=3D'/bin/pg_dumpall -v -g'; >> log "INFO" "Running: ${cmd}"; # DUMP: ${backuproles} ERRORS:=20 >>${roles_logs}"; >> exec 1>${backuproles}; >> exec 2> ${roles_logs}; >> ${cmd}; >> ret=3D$?; >> exec 1>/dev/tty 2>&1; >> >> if [[ $ret -gt 0 && $ret -lt 127 ]]; then >> log "ERROR" "Backup for PG roles failed. See ${roles_logs} for=20 >>details"; >> error_exit; >> else >> log "INFO" "Roles were successfully backed up to ${backuproles}" >> fi >> >>} >> >>dumpDB() { >> >> log "INFO" "Starting pg_dump on ${dbname}" >> cmd=3D"pg_dump --dbname ${dbname} --jobs=3D${jobs} -Fd -f=20 >>${sqlDir}/${dbname} --verbose"; >> log "INFO" "Running: ${cmd}"; >> exec 1>/dev/tty >> exec 2>> ${pgdump_logs}; >> >> ${cmd}; >> >> exec 1>/dev/tty 2>&1; >> >> if [[ $ret -gt 0 && $ret -lt 127 ]]; then >> log "ERROR" "pg_dump failed on ${dbname}. See ${pgdump_logs} for=20 >>details"; >> error_exit; >> else >> log "INFO" "PG-DUMP finished successfully" >> fi >> >>} >> >>backup_postgres() { >> >> dumpRoles; >> dumpDB; >> >>} >> >>restore_postgres() >>{ >> # log "INFO" "Start restoring roles." >> # psql --host=3D{target_rds_host} --dbname=3D${dbname} --port=3D5432 = -U=20 >>${rds_pguser} < ${backuproles} >> # rc=3D? >> # if [ "${rc}" =3D=3D "0" ]; then >> # log "INFO" "Restore roles finished successfully." >> # else >> # log "ERROR" "Something wrong happned while restoring roles." >> # error_exit >> # fi >> # if [ $(pg_restore --verbose --host=3D${target_rds_host}=20 >>--dbname=3D${new_dbname} --port=3D5432 --no-owner --role=3D${rds_pguser}= -U=20 >>${rds_pguser} ${backupDir} --jobs=3D${jobs} 2>> ${restore_logs}) $? -eq= =20 >>0 ]; then >> # log "INFO" "PG-RESTORE finished successfully." >> # else >> # log "ERROR" "Something wrong happned while running=20 >>pg_restore." >> # error_exit >> # fi >> log "INFO" "Starting postgres restore"; >> cmd=3D"pg_restore -v --host=3D${target_rds_host}=20 >>--dbname=3D${new_dbname} --port=3D5432 -U ${rds_pguser} ${backupDir}=20 >>--jobs=3D${jobs}"; >> log "INFO" "Running: ${cmd}"; >> exec 2>> ${restore_logs}; >> $( ${cmd} ); >> ret=3D$?; >> exec 1>/dev/tty 2>&1; >> >> if [ $ret -ne '0' ]; then >> log "INFO" "PG-RESTORE finished successfully." >> else >> log "ERROR" "Something wrong happned while running=20 >>pg_restore." >> error_exit >> fi >>} >> >> >># main >>createDirs; >>createLogFiles; >>backup_postgres >> >> >>restore_postgres >>-------------------------------------------------------------------------= ------------------------------------------------ >> >> >> > > >-- >Regards, >Avinash Vallarapu (Avi) --------=_MBB7170C12-C35A-48E2-B3C0-5177DD79CEF3 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
I suggest you can cha= nge the replica identity to Full and replicate the data. you may see more w= alfiles as compare to now a days.=C2=A0

=C2=A0
=C2=A0
=C2=A0

Regards,

Anjul TYAGI

=C2=A0

=C3=BC<= /b>=C2=A0Go=C2= =A0Green


------ Original Message ------
From: "Avinash Kumar" <avinash.vallarapu@gmail.com>
To: "Walters Che Ndoh" <chend= ohw@gmail.com>
Sent: 11/9/2020 12:37:21 AM
Subject: Re: Backup restore for upgrade

Hi,


On Sun, Nov 8, 2020 = at 2:22 AM Walters Che Ndoh <chen= dohw@gmail.com> wrote:
Hi All,

I am trying to upgrade= one of my 1TB databases from pg9.5 to 10 and having some troubles.
Firs= t I tried using pglogical and it failed because most of the tables didn't h= ave a primary key.
Second, i tried pg_upgrade and it also failed= with some really weird errors.
See if te= mporarily you could add a sequence column as a Primary key column to the li= st of tables without a primary key. If not see below.=C2=A0

<= div>At this point, I am really convinced that the upgrade can only be possi= ble by me taking a dump of the old version and restore it in the new versio= n on a new server.
So I am working on this script to help me take = a dump from the old version server and restore it into the pg10 server.=C2= =A0
I am trying to speed up the process using some jobs based o= n my cpu.
The script doesn't work as intended...especially the re= store part as it just stops at the restore part. Maybe the dump format..??<= br />
It will be great to see and understand t= he issue if you could share some error messages during restore.
Howeve= r, see if you are using the binaries of the latest (target) version for bot= h pg_dump and pg_restore. There can sometimes be challenges when you are us= ing Older version binaries to perform the dump and restore.=C2=A0

P= lease can someone help me review the script below maybe i am making errors= at defining the variables or at the function level.
OR if= you have a better script to recommend i will=C2=A0appreciate it.
=
Thanks

script
--------------------------------------------------------------------= ---------------------------------------------------
#!= /bin/bash

jobs=3D6;
mydate=3D$(date +"%= Y%m%d%H%M%S");
env=3Dprod;
dbname=3Dtest;
rds_pguser=3Dtest_= user;
host=3Dlocalhost;

backupDir=3D/var/lib/data/backup/`d= ate +%Y-%m-%d`;
sqlDir=3D${backupDir}/sql;
logDir=3D${backupDir}/= logs;
backuproles=3D${backupDir}/globals-${env}-${mydate}.sql;
# Logs source instance
roles_logs=3D${logDir}/roles_logs-${env}-${= mydate}.log;
pgdump_logs=3D${logDir}/pgdump_logs-${env}-${mydate}.log;=
restore_logs=3D${logDir}/restore_logs-${env}-${mydate}.log;
proc= ess_log=3D${logDir}/process_log-${env}-${mydate}.log;

# RDS Targ= et host
target_rds_host=3D"IP of destination server";
rds_pguser= =3Dtest_user;
new_dbname=3Dtest;
wait_in_seconds=3D1800;

GREEN=3D"\033[32m"; BLUE=3D"\033[34m"; RED=3D"\033[31m"; RESET=3D"\033[0= m"; YELLOW=3D"\033[33m";

# Functions
log() {
=C2=A0 lo= cal log_info=3D$1;
=C2=A0 if [[ "${log_info}" =3D=3D "INFO" ]]; then=C2=A0 =C2=A0 echo -e "${BLUE}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%= S") ]: =C2=A0$2 ${RESET}";
=C2=A0 =C2=A0 echo -e "[ ${log_info} - $(da= te +"%Y-%m-%d %H:%M:%S") ]: =C2=A0$2" >> ${process_log};
=C2=A0= elif [[ "${log_info}" =C2=A0=3D=3D "WARN" ]]; then
=C2=A0 =C2=A0 echo= -e "${YELLOW}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: =C2=A0$2 ${RES= ET}";
=C2=A0 =C2=A0 echo -e "[${log_info} - $(date +"%Y-%m-%d %H:%M:%S= ") ]: =C2=A0$2" >> ${process_log};
=C2=A0 elif [[ "${log_info}" = =3D=3D =C2=A0"SUCC" ]]; then
=C2=A0 =C2=A0 echo -e "${GREEN}[ ${log_i= nfo} - $(date +"%Y-%m-%d %H:%M:%S") ]: =C2=A0$2 ${RESET}";
=C2=A0 =C2= =A0 echo -e "[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: =C2=A0$2" >= > ${process_log};
=C2=A0 elif [[ "${log_info}" =3D=3D =C2=A0"EXIT"= ]]; then
=C2=A0 =C2=A0 echo -e "${RED}[ ${log_info} - $(date +"%Y-%m-%= d %H:%M:%S") ]: =C2=A0$2 ${RESET}";
=C2=A0 =C2=A0 echo -e "[ ${log_inf= o} - $(date +"%Y-%m-%d %H:%M:%S") ]: =C2=A0$2" >> ${process_log};=C2=A0 elif [[ "${log_info}" =3D=3D =C2=A0"ERROR" ]]; then
=C2=A0= =C2=A0 echo -e "${RED}[ ${log_info} - $(date +"%Y-%m-%d %H:%M:%S") ]: =C2=A0$= 2 ${RESET}";
=C2=A0 =C2=A0 echo -e "[ ${log_info} - $(date +"%Y-%m-%d= %H:%M:%S") ]: =C2=A0$2" >> ${process_log};
=C2=A0 fi
}

error_exit() {
=C2=A0 log "EXIT" "Exiting due to errors!";
=C2=A0 #send_email "${body_mail_log}" "${status}"
=C2=A0 exit 1;
}

createLogFiles() {

=C2=A0 for file in ${roles_logs= } ${pgdump_logs} ${restore_logs} ${process_log}; do
=C2=A0 =C2=A0 touc= h ${file};
=C2=A0 =C2=A0 ret=3D$?;
=C2=A0 =C2=A0 if [ ${ret} -ne= 0 ]; then
=C2=A0 =C2=A0 =C2=A0 echo "ERROR: Unable to create file [${f= ile}]: ${ret}";
=C2=A0 =C2=A0 =C2=A0 exit 1;
=C2=A0 =C2=A0 fi;
=C2=A0 done;

}

createDirs() {

=C2=A0 fo= r dir in ${backupDir} ${logDir} ${sqlDir}; do
=C2=A0 =C2=A0 if [[ ! -d = "${dir}" ]]; then
=C2=A0 =C2=A0 =C2=A0 mkdir -p ${dir}; ret=3D$?;=C2=A0 =C2=A0 =C2=A0 if [ ${ret} -ne 0 ]; then
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 echo "ERROR: Failed creating directory [${dir}] failed: ${ret}";
=C2=A0 =C2=A0 =C2=A0 =C2=A0 exit 1;
=C2=A0 =C2=A0 =C2=A0 fi;
= =C2=A0 =C2=A0 fi;
=C2=A0 done;

}

dumpRoles() {
=C2=A0 log "INFO" "Start backing up PG-Roles."

=C2=A0= cmd=3D'/bin/pg_dumpall -v -g';
=C2=A0 log "INFO" "Running: ${cmd}"; # = =C2=A0 =C2=A0DUMP: ${backuproles} =C2=A0ERRORS: ${roles_logs}";
=C2= =A0 exec 1>${backuproles};
=C2=A0 exec 2> ${roles_logs};
= =C2=A0 ${cmd};
=C2=A0 ret=3D$?;
=C2=A0 exec 1>/dev/tty 2>&a= mp;1;

=C2=A0 if [[ =C2=A0$ret -gt 0 && $ret -lt 127 ]];= then
=C2=A0 =C2=A0 log "ERROR" "Backup for PG roles failed. See ${role= s_logs} for details";
=C2=A0 =C2=A0 error_exit;
=C2=A0 else
= =C2=A0 =C2=A0 log "INFO" "Roles were successfully backed up to ${backuprole= s}"
=C2=A0 fi

}

dumpDB() {

=C2=A0 log = "INFO" "Starting pg_dump on ${dbname}"
=C2=A0 cmd=3D"pg_dump --dbname = ${dbname} --jobs=3D${jobs} -Fd -f ${sqlDir}/${dbname} --verbose";
=C2= =A0 log "INFO" "Running: ${cmd}";
=C2=A0 exec 1>/dev/tty
=C2= =A0 exec 2>> ${pgdump_logs};

=C2=A0 ${cmd};

=C2= =A0 exec 1>/dev/tty 2>&1;

=C2=A0 if [[ $ret -gt 0 &= ;& $ret -lt 127 ]]; then
=C2=A0 =C2=A0 log "ERROR" "pg_dump failed = on ${dbname}. See ${pgdump_logs} for details";
=C2=A0 =C2=A0 error_ex= it;
=C2=A0 else
=C2=A0 =C2=A0 log "INFO" "PG-DUMP finished succes= sfully"
=C2=A0 fi

}

backup_postgres() {

=C2=A0 dumpRoles;
=C2=A0 dumpDB;

}

restore_po= stgres()
{
=C2=A0 =C2=A0 # log "INFO" "Start restoring roles."
=C2=A0 =C2=A0 # psql --host=3D{target_rds_host} --dbname=3D${dbname} --p= ort=3D5432 -U ${rds_pguser} =C2=A0< ${backuproles}
=C2=A0 =C2=A0 #= rc=3D?
=C2=A0 =C2=A0 # if [ "${rc}" =3D=3D "0" ]; then
=C2=A0 =C2= =A0 # =C2=A0 =C2=A0 log "INFO" "Restore roles finished successfully."
= =C2=A0 =C2=A0 # else
=C2=A0 =C2=A0 # =C2=A0 =C2=A0 log "ERROR" "Someth= ing wrong happned while restoring roles."
=C2=A0 =C2=A0 # =C2=A0 =C2= =A0 error_exit
=C2=A0 =C2=A0 # fi
=C2=A0 =C2=A0 # if [ $(pg_resto= re --verbose --host=3D${target_rds_host} --dbname=3D${new_dbname} --port=3D= 5432 --no-owner --role=3D${rds_pguser} -U ${rds_pguser} ${backupDir} --jobs= =3D${jobs} 2>> ${restore_logs}) $? -eq 0 ]; then
=C2=A0 =C2=A0 # = =C2=A0 =C2=A0 log "INFO" "PG-RESTORE finished successfully."
=C2=A0 = =C2=A0 # else
=C2=A0 =C2=A0 # =C2=A0 =C2=A0 log "ERROR" "Something wr= ong happned while running pg_restore."
=C2=A0 =C2=A0 # =C2=A0 =C2=A0 e= rror_exit
=C2=A0 =C2=A0 # fi
=C2=A0 =C2=A0 log "INFO" "Starting p= ostgres restore";
=C2=A0 =C2=A0 cmd=3D"pg_restore -v --host=3D${target= _rds_host} --dbname=3D${new_dbname} --port=3D5432 -U ${rds_pguser} ${backup= Dir} --jobs=3D${jobs}";
=C2=A0 =C2=A0 log "INFO" "Running: ${cmd}";
=C2=A0 =C2=A0 exec 2>> ${restore_logs};
=C2=A0 =C2=A0 $( ${cm= d} );
=C2=A0 =C2=A0 ret=3D$?;
=C2=A0 =C2=A0 exec 1>/dev/tty 2&= gt;&1;

=C2=A0 =C2=A0if [ $ret -ne '0' ]; then
=C2=A0= =C2=A0 =C2=A0 =C2=A0 log "INFO" "PG-RESTORE finished successfully."
=C2= =A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 log "ERROR" "Something wro= ng happned while running pg_restore."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 erro= r_exit
=C2=A0 =C2=A0 fi
}


# main
createDirs= ;
createLogFiles;
backup_postgres


restore_postgr= es=C2=A0
------------------------------------------------= -------------------------------------------------------------------------= =C2=A0





--
Regards,
Avin= ash Vallarapu (Avi)
--------=_MBB7170C12-C35A-48E2-B3C0-5177DD79CEF3--