X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2B45611F6AA5 for ; Sat, 1 Apr 2006 06:58:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32456-01 for ; Sat, 1 Apr 2006 06:58:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.188]) by postgresql.org (Postfix) with ESMTP id C1F3911F65B3 for ; Sat, 1 Apr 2006 06:58:42 -0400 (AST) Received: by nproxy.gmail.com with SMTP id g2so875799nfe for ; Sat, 01 Apr 2006 02:58:42 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BJ0MtOCny61iDu0tWaqUhbZ3eZyIu4vuugqbwxWX++deRnu1qNnPWapURzQQ8vajpxrDRlJPtYq7gsa/ReG+qa29/mGX8X6Oh8UdggyDogjtIZ94uheuzSj5/KogEhV2oe8VLoB5VnraoRAD3MDxu1B13VDGQRkQ/OFkPz7/xcY= Received: by 10.49.75.11 with SMTP id c11mr201416nfl; Sat, 01 Apr 2006 02:58:42 -0800 (PST) Received: by 10.49.26.20 with HTTP; Sat, 1 Apr 2006 02:58:42 -0800 (PST) Message-ID: Date: Sat, 1 Apr 2006 16:28:42 +0530 From: "Rajesh Kumar Mallah" To: "Grega Bremec" Subject: Re: FW: Setting up of PITR system. Cc: pgsql-admin@postgresql.org In-Reply-To: <442E1945.4030006@p0f.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <442B93DD.4020305@p0f.net> <442E1945.4030006@p0f.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.555 required=5 tests=[AWL=0.555] X-Spam-Score: 0.555 X-Spam-Level: X-Archive-Number: 200604/6 X-Sequence-Number: 21175 On 4/1/06, Grega Bremec 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 fil= e # 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=3D$DATADIR/backup_label # get the like containing line START WAL LOCATION START_LINE=3D`grep -i "START WAL LOCATION" $BACKUP_LABEL` # strip something like 'START WAL LOCATION: E/A9145E4 (file ' from begin. START_LINE=3D${START_LINE/#START*file /} # strip ')' from end. START_LINE=3D${START_LINE/%)/} # REF_FILE_NUM is something like 000000010000000A00000068 REF_FILE_NUM=3D$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=3D"" ~ find ${WAL_ARCHIVE} -type f | sort -g | while read archive; do ~ if [ ! "${archive}" =3D "${REF_FILE}" ]; then i think you meant < instead of '=3D' in above line. ~ RM_LIST=3D"${RM_LIST:+${RM_LIST} }${archive}" ~ else ~ break ~ fi ~ done ~ rm -f ${RM_LIST} last doubt: regarding $ env LC_ALL=3D"C" backup_script.sh can i do export LC_ALL=3D"C" or LC_ALL=3D"C" inside the script itself to be sure ? Thanks for you help once again. Regds Rajesh Kumar Mallah.