Re: Pg_dump options - Mailing list pgsql-general

From Devrim GUNDUZ
Subject Re: Pg_dump options
Date
Msg-id Pine.LNX.4.44.0201300937070.23571-100000@oper.metu.edu.tr
Whole thread Raw
In response to Pg_dump options  (Troy.Campano@LibertyMutual.com)
List 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@oper.metu.edu.tr
devrim.gunduz@linux.org.tr
devrimg@tr.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.Campano@LibertyMutual.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 <==:]
>
>





pgsql-general by date:

Previous
From: "Ben-Nes Michael"
Date:
Subject: Re: Upgrade 7.0.3 -> 7.1.3 problems!
Next
From: Ben-Nes Michael
Date:
Subject: Re: unique & update