On 4/1/06, Grega Bremec <gregab@xxxxxxx> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: RIPEMD160 > > Rajesh Kumar Mallah wrote: > | Dear Grega , > | > | Thanks for the useful tips and error spotting, > | i am incorporating some of them and testing > | the script in my server . I have concerns regarding > | some of your optimisations that makes the script less > | generic , below find my comments. > | > > Hello, Rajesh, > > I'm glad you found some use to the comments :). Hmm i am glad , i have found one person whom i can ask any bash doubt ;-) i am discussing only the differentials and not posting the flab. As described in docs pg_start_backup() puts the file backup_label in the datadir which can has the info about the start log file. Instead of taking a round about method i am using the content of the file, (This was also suggested by Andy at somepoint) below is the code . # read the backup_label file in pgdatadir and get the name of start wal file # below is example content. ############################################################## #START WAL LOCATION: E/A9145E4 (file 000000010000000E0000000A) #CHECKPOINT LOCATION: E/A92939C #START TIME: 2006-04-01 14:36:48 IST #LABEL: base_backup_01-04-2006-14-36-45 ############################################################### BACKUP_LABEL=$DATADIR/backup_label # get the like containing line START WAL LOCATION START_LINE=`grep -i "START WAL LOCATION" $BACKUP_LABEL` # strip something like 'START WAL LOCATION: E/A9145E4 (file ' from begin. START_LINE=${START_LINE/#START*file /} # strip ')' from end. START_LINE=${START_LINE/%)/} # REF_FILE_NUM is something like 000000010000000A00000068 REF_FILE_NUM=$START_LINE ------------------ End of relevent portion --------------------------------------- please optimize the above regex capturing process if possible. lately i feel that we should not be discussing the topic over here becoz it has less to do with postgresql and more of bash. ~ RM_LIST="" ~ find ${WAL_ARCHIVE} -type f | sort -g | while read archive; do ~ if [ ! "${archive}" = "${REF_FILE}" ]; then i think you meant < instead of '=' in above line. ~ RM_LIST="${RM_LIST:+${RM_LIST} }${archive}" ~ else ~ break ~ fi ~ done ~ rm -f ${RM_LIST} last doubt: regarding $ env LC_ALL="C" backup_script.sh can i do export LC_ALL="C" or LC_ALL="C" inside the script itself to be sure ? Thanks for you help once again. Regds Rajesh Kumar Mallah.