From: | Devrim GUNDUZ <devrim(at)oper(dot)metu(dot)edu(dot)tr> |
---|---|
To: | terry(at)greatgulfhomes(dot)com |
Cc: | nothanks(at)nowhere(dot)com, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Help automate pg_dump |
Date: | 2002-06-18 14:28:54 |
Message-ID: | Pine.LNX.4.44.0206181724540.6304-100000@oper.metu.edu.tr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
Below is what I have written to the list previously. All you need is to
install expect to your machine, if you do not have it.
****************
1. /usr/sbin/createdbbackups.sh
pg_dump dbname_1 > dbname_1.pgdump -p 5434 -u;
pg_dump dbname_2 > dbname_2.pgdump -p 5434 -u;
...
In this file, you should write the name of the databases that you want to
get the dump of.
Let's say you have 4 databases to backup.
2. /usr/sbin/dbbackup
#!/usr/bin/expect -f
set env(SHELL) /bin/sh
set env(HOME) /usr/sbin/
spawn /usr/sbin/createdbbackups.sh
expect 'User name':
send postgres\r
expect Password:
send PostgreSQL_Passwd\r
In this file, you'll write the last four lines 4 times (assuming that you
have 4 databases in your system.) Each 4 line must correspond the
databases listed in the first file.
I mean, if dbname_1 belongs to postgres user, that write postgres and its
password on the first line. If dbname_2 belongs to (let's say) surojit
user, then write suroojit and ist password there:
expect 'User name':
send surojit\r
expect Password:
send Passwd_Of_surojit\r
At the very end of this file, add the following:
spawn /usr/sbin/movedbbackups.sh
3. /usr/sbin/movedbbackups.sh
mv dbname_1.pgdump /backup/`date '+%d-%m-%Y'`;
mv dbname_2.pgdump /backup/`date '+%d-%m-%Y'`;
...
This is for moving the dumps in a daily directory.
(TO create the directory, you could use
cd /backup;
mkdir `date '+%d-%m-%Y'`
)
***************************
Regards,
Devrim
On Tue, 18 Jun 2002 terry(at)greatgulfhomes(dot)com wrote:
> Hmmm.
>
> Please let the list know if you get a solution, I am about to go to 7.2 on
> my production machines but that could be a show stopper if the cron job
> cannot automatically back it up anymore.
>
> Terry Fielder
> Network Engineer
> Great Gulf Homes / Ashton Woods Homes
> terry(at)greatgulfhomes(dot)com
>
> > -----Original Message-----
> > From: pgsql-general-owner(at)postgresql(dot)org
> > [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of
> > nothanks(at)nowhere(dot)com
> > Sent: Monday, June 17, 2002 10:01 PM
> > To: pgsql-general(at)postgresql(dot)org
> > Subject: [GENERAL] Help automate pg_dump
> >
> >
> > We just upgraded from 7.1.3 to 7.2.1 and are at a loss on how to
> > script the pg_dump routine. We use this tool for backup, but can not
> > get around the requirement for username/password to be interactive.
> >
> > We require login from the localhost, and can not revert to trusted
> > connections.
> >
> > If the username/password must be interactive, how can I script backup
> > of the server?
> >
> > Evan,
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
--
Devrim GUNDUZ
devrim(at)oper(dot)metu(dot)edu(dot)tr
devrim(dot)gunduz(at)linux(dot)org(dot)tr
Web : http://devrim.oper.metu.edu.tr
-------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2002-06-18 14:30:17 | Re: Help automate pg_dump |
Previous Message | Don Isgitt | 2002-06-18 14:28:24 | Re: Help automate pg_dump |