Re: Crontab and PostgreSQL Backup

Lists: pgsql-admin
From: Fabio Alberto Sobral <sobral(at)lncc(dot)br>
To: pgsql-admin(at)postgresql(dot)org
Subject: Crontab and PostgreSQL Backup
Date: 2000-10-05 18:36:46
Message-ID: 39DCCA3D.5D8FD5CF@lncc.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

Dear Sirs,

I use PostgreSQL version 7.0.2 for Linux Conectiva 5.1 Server, and I
would
like to know how do I do to configure and start the PostgreSQL's backup
and restore
using crontab?
Any Tips?

Regards,

Fabio Sobral.


From: Gunnar Lindholm <gunix(at)telia(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Crontab and PostgreSQL Backup
Date: 2000-10-05 19:53:41
Message-ID: 00100522053800.00314@dilbert
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin

>I use PostgreSQL version 7.0.2 for Linux Conectiva 5.1 Server, and I
> would like to know how do I do to configure and start the PostgreSQL's backup
> and restore
>using crontab?

restore with crontab???

Anyway.
Put a line in crontab like:
3 5 * * * /script/backdb.sh

and the script /script/backdb.sh
could then look like:

#!/bin/bash
DATE=`date +%Y%m%d`
/usr/pgsql/bin/pg_dump databas > /tmp/dump.$DATE

then you have a file in /tmp/dump.$DATE that you could put on tape or whatever
you use. Use pg_dumpall if you want all databases.
You might want to consider making a backup of the files (for example
pg_hba.conf) in PGDATA directory. Read the man page for details about OID's.

Good luck.
Gunnar.