Re: Pg_dump options

From: Devrim GUNDUZ <devrim(at)oper(dot)metu(dot)edu(dot)tr>
To: Troy(dot)Campano(at)LibertyMutual(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Pg_dump options
Date: 2002-01-30 07:47:54
Message-ID: Pine.LNX.4.44.0201300937070.23571-100000@oper.metu.edu.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,

YOu could do it by using expect:
Here is a sample code:

---------------
1. backup.sh

#!/usr/bin/expect -f
set env(SHELL) /bin/sh
set env(HOME) /usr/sbin/

spawn /usr/sbin/createdbbackups.sh

expect Username:
send postgres\r
expect Password:
send YourPasswdHere\r

2.createdbbackups.sh

pg_dump mydb > mydb.pgdump -p 5456 -u;

---------------

If you are having a backup for more than one database, you should write
their names in the second file, and write the last four lines in the first
file (beginning with expect, ending with the passwd line) as many as the
number of your databases.

Regards and best wishes,

--

Devrim GÜNDÜZ

devrim(at)oper(dot)metu(dot)edu(dot)tr
devrim(dot)gunduz(at)linux(dot)org(dot)tr
devrimg(at)tr(dot)net

Phone : +90-535-328-9594 (cellular)-
Phone : +90-312-295-9595 (work)
Phone : +90-312-286-5906 (home)

Web : http://devrim.oper.metu.edu.tr
------------------------------------------------------------------

On Mon, 28 Jan 2002 Troy(dot)Campano(at)LibertyMutual(dot)com wrote:

> Is there a way to supply a username and password in one command using
> pg_dump?
>
>
> For example is it possible to do this so it doesn't prompt you for a
> username/password:
>
>
>
> pg_dump mydb --username=dbuser --password=dbpass > myfile.out
>
>
>
> Thank you!
>
> [:==> Troy Campano <==:]
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben-Nes Michael 2002-01-30 08:03:00 Re: unique & update
Previous Message Ben-Nes Michael 2002-01-30 07:40:54 Re: Upgrade 7.0.3 -> 7.1.3 problems!