pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pgsql-admin <pgsql-admin@fc.emc.com.ph>
To: pgsql-admin@postgresql.org
Subject: Re(2): Crontab and PostgreSQL Backup
Date: Fri, 06 Oct 2000 19:48:03 +0800
Message-ID: <fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph> (raw)

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@telia.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.





view thread (3+ messages)  latest in thread

Message-ID: <fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph>
Permalink:  ../fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph/
Also on:    postgresql.org/message-id/fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgsql-admin@fc.emc.com.ph
  Subject: Re: Crontab and PostgreSQL Backup
  In-Reply-To: <fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph>
  References: <fc.000f5672007249bd000f5672007249bd.7249f3@fc.emc.com.ph>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox