Received: from jennifer.emc.com.ph (IDENT:postfix@una-jennifer.emc.com.ph [208.232.224.3]) by hub.org (8.10.1/8.10.1) with ESMTP id e96BmTJ57388 for ; Fri, 6 Oct 2000 07:48:30 -0400 (EDT) Received: from fc.emc.com.ph (fc.emc.com.ph [208.232.224.197]) by jennifer.emc.com.ph (Postfix) with ESMTP id A1287D757; Fri, 6 Oct 2000 19:48:04 +0800 (PST) Message-id: Date: Fri, 06 Oct 2000 19:48:03 +0800 Subject: Re(2): Crontab and PostgreSQL Backup To: pgsql-admin@postgresql.org From: "pgsql-admin" MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200010/30 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.