Re: Help automate pg_dump - Mailing list pgsql-general

From philip johnson
Subject Re: Help automate pg_dump
Date
Msg-id NDBBJLHHAKJFNNCGFBHLGEEBDJAA.philip.johnson@atempo.com
Whole thread Raw
In response to Re: Help automate pg_dump  (terry@greatgulfhomes.com)
List pgsql-general
in the crontab of postgres user you could use
0 6  * * * ( cd /appl_logs/postgresql/ && /opt/pgsql/pg_backup.sh -db
dbname )

and pg_backup.sh could be like this
#!/bin/bash
#
# pg_backup.sh
#
# Database backup
#
# Parametres :
#       -db <db name>
#
# a file (with the following format <db name>.<date>-<hour>.dump.gz) will be
created in the current
# directory
#

usage()
{
    echo "`basename $0` -db <db name>"
    exit 1
}

if [ "$1" != "-db" ]; then
    usage
fi

DBNAME="$2"
DATE=`date +%Y%m%d`
TIME=`date +%H%M`
SAV_DB_FILENAME="$DBNAME.$DATE-$TIME.dump.gz"
~postgres/bin/pg_dump $DBNAME | gzip -c9 >$SAV_DB_FILENAME


-----Message d'origine-----
De : pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]De la part de
terry@greatgulfhomes.com
Envoyé : mardi 18 juin 2002 15:24
À : nothanks@nowhere.com; pgsql-general@postgresql.org
Objet : Re: [GENERAL] Help automate pg_dump


Hmmm.

Please let the list know if you get a solution, I am about to go to 7.2 on
my production machines but that could be a show stopper if the cron job
cannot automatically back it up anymore.

Terry Fielder
Network Engineer
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com

> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of
> nothanks@nowhere.com
> Sent: Monday, June 17, 2002 10:01 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Help automate pg_dump
>
>
> We just upgraded from 7.1.3 to 7.2.1 and are at a loss on how to
> script the pg_dump routine. We use this tool for backup, but can not
> get around the requirement for username/password to be interactive.
>
> We require login from the localhost, and can not revert to trusted
> connections.
>
> If the username/password must be interactive, how can I script backup
> of the server?
>
> Evan,
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Wierd Explain
Next
From: Thomas Beutin
Date:
Subject: Re: Wierd Explain