From: | david(dot)morgan(at)s4c(dot)co(dot)uk |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Shell Script help for backup |
Date: | 2002-07-22 14:40:11 |
Message-ID: | 7AFD985147A2D51197A700508BC75BC90DC87C@EXCHANGE |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
You don't have to compromise and use a clear passphrase, you can use
keychain, this uses ssh-agent and caches the user's passphrases:
http://www-106.ibm.com/developerworks/library/l-keyc2/
-----Original Message-----
From: strange(at)nsk(dot)yi(dot)org [mailto:strange(at)nsk(dot)yi(dot)org]
Sent: 22 July 2002 15:09
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Shell Script help for backup
On Sat, Jul 20, 2002 at 02:25:48AM -0700, ratlhead wrote:
>
> #!/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?
The script always detects a successful dump because the last command in
the pipe is gzip and it always succeeds.
You could change the [ !$? ] to something like:
[ "$( zcat /folder/pg_backup.$DATE.gzip | head -c1 | wc -c )" -eq 1 ]
> 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.
Use ncftpput or scp with no passphrase.
Regards,
Luciano Rocha
--
Consciousness: that annoying time between naps.
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
Maer neges e-bost hon ac unrhyw ffeiliau sydd ynghlwm wrthi yn gwbl gyfrinachol ac wediu bwriadu at sylw yr unigolyn neur endid y maent wedi eu cyfeirio ato yn unig. Gallant gynnwys gwybodaeth syn freintiedig yn gyfreithiol a/neun gyfrinachol ac os nad chi ywr sawl y cyfeiriwyd y neges ato, yna peidiwch chopio, dosbarthu na chymryd unrhyw gamau o ganlyniad a gan ddibynnu arni. Os ydych wedi derbyn y neges e-bost hon ar gam, a wnewch chi ein hysbysu o hyn cyn gynted phosib ai dileu os gwelwch yn dda. Barn neu safbwyntiaur awdur ywr rhai a fynegir yn y neges e-bost hon ac/neun unrhyw atodiadau ac nid ydynt yn adlewyrchu o anghenraid barn neu safbwyntiau S4C.
This e-mail message and any files attached are strictly confidential and intended solely for the attention of the person or entity to whom they are addressed. They may contain legally privileged and/or confidential information and if you are not the addressee, you should not copy, distribute nor take any action in reliance on them. If you have received this e-mail message in error, please notify us as soon as possible and delete it. The views and opinions expressed in this e-mail message and any attachments are the authors own and they do not reflect necessarily the views and opinions of S4C.
From | Date | Subject | |
---|---|---|---|
Next Message | Devrim GUNDUZ | 2002-07-22 14:43:05 | Re: Windows - why not? |
Previous Message | Andrew Sullivan | 2002-07-22 14:35:13 | Re: Windows - why not? |