RES: Shell Script help for backup

From: Elielson Fontanezi <ElielsonF(at)prodam(dot)sp(dot)gov(dot)br>
To: "'ratlhead(at)ratlhead(dot)com'" <ratlhead(at)ratlhead(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: RES: Shell Script help for backup
Date: 2002-07-22 14:12:46
Message-ID: A799F7647794D311924A005004ACEA97080DDE63@cprodamibs249.prodam
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I am so interested in your working on this!
I've just do some shell scripts to do backup and restore.
May be we can talk a little more.

About FTP'ing files. I can tell you that if you transfer backup
file which was dumped with -Fc option, it gets corrupted just after the
transfer.
I suggest that you use ascii format (-Fp) or tar format (-Ft).

Do you wanna see may shell scripts?

About your question, I need to find a way to fail the pg_dump file.
In what way? That is a good question. I'll think on it.

-----Mensagem original-----
De: ratlhead(at)ratlhead(dot)com [mailto:ratlhead(at)ratlhead(dot)com]
Enviada em: sábado, 20 de julho de 2002 06:26
Para: pgsql-general(at)postgresql(dot)org
Assunto: [GENERAL] Shell Script help for backup

Hey all,

I'm thinkin' maybe I should post this in a shell scripting group but
thought someone here may be able to help me out...

I'm lookin' to run a shell script through the crontab on a nightly
basis for backup, and not keep more than a week of backups. In those
terms, I have a script working.

But I wanna take the script to another level. Basically, I want it to
email me if pg_dump fails, but I'm having a hard time doing so.
here's what I got

#!/bin/bash
DATE=`date +%Y-%m-%d`
PGUSER=<my username>
PGPASSWORD=<my password>
export PGUSER PGPASSWORD
pg_dump <dbname> | gzip > /folder/pg_backup.$DATE.gzip
if [ !$? ]
then
find /folder/pg_backup/* -mtime 8 -exec rm -f {} \;
echo "The PostGreSQL backup for today completed successfully" | mail
ratlhead(at)ratlhead(dot)com
else
echo "The PostGreSQL backup for today was unsuccessful" | mail
ratlhead(at)ratlhead(dot)com
fi

The problem is that is always gets detected as being successful, even
if I say, comment out the export line of my user/pass. Any
suggestions on how I can detect whether or not it worked?

Something else I'll be lookin' to do is FTP'ing the backup to another
server. If anyone has suggestions on where I can look for help on
that, it'd be great.

Thanks!

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

Browse pgsql-general by date

  From Date Subject
Next Message chris.gamble 2002-07-22 14:17:00 Postgres and forte for java
Previous Message strange 2002-07-22 14:09:23 Re: Shell Script help for backup