Skip site navigation (1) Skip section navigation (2)

Re: Backup PostgreSQL

From: Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>
To: Víctor Zúñiga Maradiegue <vzunigam(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Backup PostgreSQL
Date: 2009-10-28 15:52:57
Message-ID: f205bb120910280852p67e266a4pff7b9875d245d1b5@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-es-ayuda
> #!/bin/bash
> BACKUP_PG_DIR="/home/pg-bkp"
> BACKUP_SVN_DIR="/home/svn-bkp"
> PGHOST="localhost"
> export PGUSER="postgres"
> export PGPASSWORD="xxx123"
> DATABASE="databasename"
>
> #---------------------
> #       ftp variables
> #---------------------
> FTPHOST="w.x.y.z"
> FTPUSER="ftpbkp"
> FTPPWD="pwd_ftp"
>
> time=$(date +%Y-%m-%d-%H%M%S)
>
> #----------------------------
> #       Backup & Compresion
> #----------------------------
> pg_dump $DATABASE -h $PGHOST -U $PGUSER | gzip >
> $BACKUP_PG_DIR/bkp_dbpg_$DATABASE-$time.gz
> sleep 5
>
> svnadmin dump /var/local/svn/proysvn | gzip >
> $BACKUP_SVN_DIR/bkp_svn-$time.gz
> sleep 5
>
> #-------------------------------
> #       Transferencia archivos
> #-------------------------------
> ftp -inv $FTPHOST << EOF
> user $FTPUSER $FTPPWD
>
> put $BACKUP_PG_DIR/bkp_dbpg_$DATABASE-$time.gz
> /postgres/bkp_dbpg_$DATABASE-$time.gz
> put $BACKUP_SVN_DIR/bkp_svn-$time.gz /svn/bkp_svn-$time.gz
>
> bye
> EOF
>
> unset PGUSER
> unset PGPASSWORD
>
>

Quizas quieras publicarlo en la wiki... Aunque no sabria decirte
en que sección. Lo que si es: no publiques solamente el código,
agregale documentación.

-- 
              Emanuel Calvo Franco
             DBA at:  www.siu.edu.ar
        www.emanuelcalvofranco.com.ar

In response to

pgsql-es-ayuda by date

Next:From: Xavier GuerraDate: 2009-10-28 16:03:25
Subject: AYUDA CON log_statements
Previous:From: Víctor Zúñiga MaradiegueDate: 2009-10-28 15:43:44
Subject: Backup PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group