Re: Backup Database Question

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Backup Database Question
Date: 2011-10-06 19:44:51
Message-ID: CAOR=d=29KyX+5MQ9hGrQy0h8=X3B1Hyi0v=GRyZdMJVD4oC90A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 6, 2011 at 1:18 PM, Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com> wrote:
> On Thu, Oct 6, 2011 at 3:12 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:
>>   /path/to/pg_dumpall | gzip > /path/to/pgbackup-$(date -I).sql.gz
>
> Thanks John. I've never written a script so do I just use 'Vim' to
> open a new file and just paste the following line?
>
> #!/bin/bash
> /usr/bin/pg_dumpall | gzip > /var/db_backup/pg_backup-$(date -I).sql.gz
>
> Is that all I need to do or is there more steps / data involved?

You could check if it executed and send an email when it fails.

exec_status=(/usr/bin/pg_dumpall | gzip >
/var/db_backup/pg_backup-$(date -I).sql.gz);
if [[ exec_status -ne 0 ]] ;then
//Send yourself an email here
fi;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2011-10-06 19:50:10 Re: Backup Database Question
Previous Message Carlos Mennens 2011-10-06 19:18:47 Re: Backup Database Question