Re: Backup Database Question - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Backup Database Question
Date
Msg-id CAOR=d=29KyX+5MQ9hGrQy0h8=X3B1Hyi0v=GRyZdMJVD4oC90A@mail.gmail.com
Whole thread Raw
In response to Re: Backup Database Question  (Carlos Mennens <carlos.mennens@gmail.com>)
List pgsql-general
On Thu, Oct 6, 2011 at 1:18 PM, Carlos Mennens <carlos.mennens@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 3:12 PM, John R Pierce <pierce@hogranch.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;

pgsql-general by date:

Previous
From: Carlos Mennens
Date:
Subject: Re: Backup Database Question
Next
From: Raymond O'Donnell
Date:
Subject: Re: Backup Database Question