Re: Automating databse creation

From: Thomas Pundt <mlists(at)rp-online(dot)de>
To: pgsql-general(at)postgresql(dot)org, "Ashish Karalkar" <ashish(dot)karalkar(at)info-spectrum(dot)com>
Subject: Re: Automating databse creation
Date: 2007-02-09 13:16:33
Message-ID: 200702091416.33235.mlists@rp-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)pundt(at)rp-online(dot)de> ---- http://rp-online.de/ ----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce McAlister 2007-02-09 13:31:16 Re: Automating databse creation
Previous Message Diego de Blas 2007-02-09 12:44:41 trigger for pg_authid