X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 87E47475CC4 for ; Wed, 12 Feb 2003 16:41:05 -0500 (EST) Received: from data.idl.com.au (data.idl.com.au [203.32.82.9]) by postgresql.org (Postfix) with ESMTP id 5C188475C15 for ; Wed, 12 Feb 2003 16:41:00 -0500 (EST) Received: from bishop.idl.com.au (bishop.idl.com.au [203.33.254.156]) by data.idl.com.au (8.12.3/8.12.3/Debian -4) with ESMTP id h1CKrjH0002686; Thu, 13 Feb 2003 07:53:45 +1100 Received: (from www-data@localhost) by bishop.idl.com.au (8.9.3/8.9.3/Debian 8.9.3-21) id IAA18816; Thu, 13 Feb 2003 08:37:52 +1100 X-Authentication-Warning: bishop.idl.com.au: www-data set sender to unsane@idl.com.au using -f To: Bruce Momjian Subject: Re: Database backup Message-ID: <1045085872.3e4abeb063628@mail.idl.net.au> Date: Thu, 13 Feb 2003 08:37:52 +1100 (EST) From: Preston Cc: "Panchal, Ritesh" , "'pgsql-admin@postgresql.org'" References: <200302122127.h1CLRF120096@candle.pha.pa.us> In-Reply-To: <200302122127.h1CLRF120096@candle.pha.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 User-Agent: IMP/PHP IMAP webmail program 2.2.6 X-Originating-IP: 203.110.157.48 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/174 X-Sequence-Number: 7372 Hi all, > 7.3.2 has .pgpass where you can place the password. That's a nice feature - haven't read up much on the 7.3 series as yet. It w= ill certainly remove my reliance on kludgy expect scripts to automate backups a= nd refreshes... > Panchal, Ritesh wrote: > > Hi, > > I am trying to automate my backups using pg_dump. However, I am not > > able to pass the password to the command. Has anybody sucessfully done > > automated backup thru scripts? > >=20 > > Thank you for your comments and suggestions. As above - I've used "expect" in the past with success. Stored in a secure directory that only postgres will have access to (with of course the except= ion of root...) I have a "dump_prodDB" script which looks like the following: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D expect script =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #!/usr/bin/expect spawn pg_dump prodDB -f /var/lib/pgsql/tmp/prodDB.dump -U backup_user set timeout -1 expect "Password:" send "s3cr3tpa55w0rd\r" expect eof =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D expect script =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (Where "s3cr3tpa55w0rd" is the appropriate password string or md5 password = for the backup user...) This is in turn called by the primary backup script, which backs up all the databases on the system but for those databases requiring passwords invokes= the appropriate script. Since I have only one database requiring a password I d= idn't bother to make the script generic by database name but that's relatively ea= sy. The script that calls this then does a bzip2 on the database backup. This is called as part of a Legato NetWorker savepnpc process, which then writes it= off to tape as part of the filesystem backup... As I said, it's a kludge. But it works for what I need it to do :) Cheers, -Preston. -- Oops.