[CentOS] Postgresql and shell script

Tue Oct 30 11:37:10 UTC 2007
Tronn Wærdahl <tronnw at gmail.com>

On 10/30/07, Clint Dilks <clintd at scms.waikato.ac.nz> wrote:
>
> You could set up the User so that no password is required from Localhost
> if that is appropriate
>
>
> Tronn Wærdahl wrote:
> > I have a shell script (sh) where I create a user and import data to a
> > postgres database
> >
> > <snip>
> > su -c "createuser -A -D -P $PG_user" postgres
> > su -c "psql -d$PG_database -h localhost -U$PG_user -W -f
> > postgresql.sql " postgres
> > </snip>
> >
> > when the script executes those command, it ask for a password, how
> > could I do this without have to enter the passwd, I would like that it
> > reads the password from a variabel, that excists in a separate file,
> like
> >
> > <variable file>
> > PG_passwd=secret
> > PG_user =username
> > PG_database=simple
> > </variable file>
> >
> >
> > Tronn
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS at centos.org
> > http://lists.centos.org/mailman/listinfo/centos
> >
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



Yes that is a possiblity, Joachim I dont see how this can be accomplished
with sudo, could you provide some example syntax

Tronn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20071030/aa1ad61a/attachment-0005.html>