Re: [CentOS] Postgresql and shell script

2007-10-30 Thread Craig White
On Tue, 2007-10-30 at 12:05 +0100, Tronn Wærdahl wrote: > I have a shell script (sh) where I create a user and import data to a > postgres database > > > 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 > > > wh

Re: [CentOS] Postgresql and shell script

2007-10-30 Thread Andy Harrison
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/30/07, Tronn Wærdahl wrote: > > PG_passwd=secret > PG_user =username > PG_database=simple > sudo and .pgpass would be better, but for future reference, just source the file in your script. #!/bin/sh source $HOME/.mypgvars Now your PG_* vari

Re: [CentOS] Postgresql and shell script

2007-10-30 Thread Andrea Dell'Amico
On Tue, 2007-10-30 at 12:37 +0100, Tronn Wærdahl wrote: > Yes that is a possiblity, Joachim I dont see how this can be > accomplished with sudo, could you provide some example syntax You could use the environment variable PGPASSWORD to connect to the database without entering the password. Or y

Re: [CentOS] Postgresql and shell script

2007-10-30 Thread Tronn Wærdahl
On 10/30/07, Clint Dilks <[EMAIL PROTECTED]> 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 > > > > > > su -c "cr

Re: [CentOS] Postgresql and shell script

2007-10-30 Thread Clint Dilks
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 su -c "createuser -A -D -P $PG_user" postgres su -c "psql -d$PG_database -h localhost

Re: [CentOS] Postgresql and shell script

2007-10-30 Thread Joachim Backes
Tronn Wærdahl wrote: I have a shell script (sh) where I create a user and import data to a postgres database 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 I think, the usage of sudo would solve your proble