Re: vacuum and backup - Mailing list pgsql-general

From Mitch Vincent
Subject Re: vacuum and backup
Date
Msg-id 000f01c0a0ee$70113390$0200000a@windows
Whole thread Raw
In response to Re: vacuum and backup  ("Brent R. Matzelle" <bmatzelle@yahoo.com>)
Responses Re: vacuum and backup
List pgsql-general
> I don't know; I think shell scripts are quite adequate for backup and
> VACUUM (especially since 7.x comes with the 'vacuumdb' program).  I'm
> a big Perl hound, but for something that just kicks off a couple of
> existing programs I think Perl and Python are overkill.
>
> Just MHO, and not really on-topic...

I agree 100% that a shell script is probably the best way to go.. All you're
doing is running a few utilities, there is hardly any processing on the part
of the script that calls the utilities so there isn't much of a need for
anything more than what sh (or what ever you like) has to offer..

Something quick :

#!/bin/sh

pgpath=/usr/local/pgsql/bin
homepath=/home/postgres
backup=/usr/local/pgsql/backup
today=`date "+%Y%m%d-%H%M%S"`

$pgpath/pg_dump databasename > $backup/database-${today}dump
/bin/gzip $backup/database-${today}dump
$pgpath/psql ipa databasename $homepath/database-daily.sql


As you can see it dumps to a date/time stamped file, compresses that file,
then performs what ever is in the database-daily.sql file (your vacuum and
anything else you'd care to do)..

This has served me very well for several years.. Good luck!

-Mitch





pgsql-general by date:

Previous
From: Doug McNaught
Date:
Subject: Re: vacuum and backup
Next
From: Tom Lane
Date:
Subject: Re: Permission denied while insert