Re(2): Crontab and PostgreSQL Backup

From: "pgsql-admin" <pgsql-admin(at)fc(dot)emc(dot)com(dot)ph>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re(2): Crontab and PostgreSQL Backup
Date: 2000-10-06 11:48:03
Message-ID: fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

you can also try this:

#!/bin/sh

# Backing up each database...
pg_dumpall -o | bzip2 > /var/lib/pgsql/backups/pgdumpall_`date
"+%Y%m%d"`.bz2

# Removing backups of last seven days...
find /var/lib/pgsql/backups -mtime +7 -exec rm -f {} \;

Sherwin

gunix(at)telia(dot)com writes:
>>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.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ragnar Kjørstad 2000-10-06 12:07:28 Re: Re(2): Crontab and PostgreSQL Backup
Previous Message Loïc TREGOUËT 2000-10-06 08:43:28 ssh problem ?