Re: How to get variable out to shell script

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Abel Camarillo <acamari(at)the00z(dot)org>
Cc: Alex Gadea <alex(dot)gadea(at)apptik(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to get variable out to shell script
Date: 2009-09-23 21:54:04
Message-ID: alpine.GSO.2.01.0909231637210.26451@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 20 Sep 2009, Abel Camarillo wrote:

> #!/bin/sh
> dbname=
> user=
> password=

In general it's better to use the .pgpass/PGPASSFILE mechanism:

http://www.postgresql.org/docs/current/static/libpq-pgpass.html

to cache passwords like this, if you can't eliminate the need for them
altogether through pg_hba.conf adjustments. That way, when you do change
the database user's password, there's only one place to update for all of
your scripts that talk to the database as that user. It's better still to
parameterize all of these connection things into a global configuration
file, but now you're talking an extra bit of coding; pgpass support you
basically get for free in your app if it's talking to the database with
psql.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bryan Montgomery 2009-09-23 22:00:03 Re: Looking for way to replicate master db to multiple mobile databases
Previous Message Shane Spencer 2009-09-23 21:41:34 Re: More straight forward method to convert seconds::bigint to interval