Creating an hourly backup - Mailing list pgsql-general

From Jason Tesser
Subject Creating an hourly backup
Date
Msg-id 04875CB4331F0240A0AD66F970978651160AFF@paul
Whole thread Raw
Responses Re: Creating an hourly backup
Re: Creating an hourly backup
List pgsql-general
I am trying to get an hourly backup of postgres.  I tried using the
script below
but when I try to restore off the dumped file it throws an error that
says it
cannot read the data [-1].  If I just type in pg_dump -Fc --file=***
username=**** database
it restores fine.  So something is going on with the
except script, posted below.  Can someone send me a working
cron or except script so I can get an hourly snapshot
of our databases?

#!/usr/bin/expect -f

###############################################
###############################################
# Script to backup PostgreSQL Database
# usage:
# ./dbbackup.exp [username] [password] [dbname] # # Use this script in a
cron job to do nightly # backups # Date format is MMHHDDMMYYYY
###############################################
###############################################

set username [lindex $argv 0]
set password [lindex $argv 1]
set database [lindex $argv 2]
set time [timestamp -format %M%H%d%m%Y]

spawn {pg_dump} -Fc --username=dbdevel
--file=/var/lib/pgsql/backups/$database.$time $database # expect
"Username:"
# send "$username\r"
expect "Password:"
send "$password\r"
expect eof

Jason Tesser
Web/Multimedia Programmer


pgsql-general by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: [PERFORM] Tuning queries on large database
Next
From:
Date:
Subject: Re: Creating an hourly backup