Hello,
I am planning to make setup for warm standby databae in postgres. But I am facing problem when I try to apply WAL files using shell scripts restore.sh.
After applying exiting WAL file in archive directory, it does not wait for next WAL files and come out and write the message in database logfile which show that
Archive recovery is completed.Now system is ready for use.
I check this restore.sh file and tried to debug which show syntax error in below mentioned line.
Can anybody tell me why it is showing syntax error and why it is not waiting for next WAL files
Restore.sh
#!/bin/bash
RESTORE_FROM=$1
RESTORE_TO=$2
DELAY=100000
TRIGGERED=0
TRIGGER_FILE="/home/backup/trigger"
copyfunc() {
if [ "$TRIGGERED" -eq "0" ]; then
cp -v -i $RESTORE_FROM $RESTORE_TO
fi
}
k=`expr $1 : '.*\(history\)'` ------------this is the line which show syntax error
if [ "$k" == "history" ]; then
copyfunc;
exit $?;
fi
while [ ! -f "$RESTORE_FROM" -a "$TRIGGERED" -eq "0" ]; do
usleep $DELAY;
if [ -e $TRIGGER_FILE ]; then
TRIGGERED=1;
fi
done
copyfunc;
when I debug this script through command sh –x restore.sh
it show like that.
+ RESTORE_FROM=
+ RESTORE_TO=
+ DELAY=100000
+ TRIGGERED=0
+ TRIGGER_FILE=/home/backup/trigger
++ expr : '.*\(history\)'
expr: syntax error
+ k=
+ '[' '' == backup ']'
+ '[' '!' -f '' -a 0 -eq 0 ']'
+ usleep 100000
+ '[' -e /home/backup/trigger ']'
+ TRIGGERED=1
+ '[' '!' -f '' -a 1 -eq 0 ']'
+ copyfunc
+ '[' 1 -eq 0 ']'
Praveen kumar DBA -Delivery
E-mail: praveen.k@renaissance-it.com | Extn: 1607
Sobha Renaissance Information Technology (P) Ltd.
An SEI-CMM, P-CMM & SSE-CMM Level 5 Company | BS ISO/IEC 27001:2005 & ISO 9001:2000 Certified
A Top 50 Fast Growing Technology Company (Deloitte, 2006 & 2007) | A Six Sigma Practice Company
Phone: + 91 80 41951999 | Fax: + 91 80 41523300
URL: www.renaissance-it.com | Video Conference: + 91 80 41252222
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete all copies from any computer.