Re: Automating databse creation - Mailing list pgsql-general

From Thomas Pundt
Subject Re: Automating databse creation
Date
Msg-id 200702091416.33235.mlists@rp-online.de
Whole thread Raw
In response to Automating databse creation  ("Ashish Karalkar" <ashish.karalkar@info-spectrum.com>)
List pgsql-general
Hi,

On Friday 09 February 2007 08:53, Ashish Karalkar wrote:
| I want to automate database creation, user creation,table creation via
| script. this script will be run by an external programme to postgresql
| server. is there any way?
|
| what i want to do is as follows:
|
|
| #!/bin/sh
|
| su - postgres

[rest of not working script]

| is there any way??
|
| right now the scripts stop after switching over to postgres user.

assuming the script is run as user root, you can invoke it as
su - postgres -c /path/to/script

Just remove the "su - postgres" from your script. You might want to look
at your init scripts (/etc/init.d/postgresql I assume) for how they do it.

Ciao,
Thomas

--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----

pgsql-general by date:

Previous
From: "Diego de Blas"
Date:
Subject: trigger for pg_authid
Next
From: "Bruce McAlister"
Date:
Subject: Re: Automating databse creation