Re: Scripting a new db server setup

bpalmer <bpalmer@crimelabs.net>

From: bpalmer <bpalmer@crimelabs.net>
To: A E <cooljoint@yahoo.com>
Cc: pgsql-general@postgresql.org
Date: 2004-01-04T16:24:33Z
Lists: pgsql-general
> Was wondering if there are ways to completely script a new postgresql installation. I need to be able to create the db, users, and db elements from one command so that I can included it in a setup routine.

That's rather easy.

A shell script can do roughly the following:

- initdb somewhere
- start PG
- run 'psql template1 < myload.sql'

The myload.sql would connect to template1,  do a "createdb newdbname" and 
start creating tables,  etc.

Almost the same concept as doing a restore from a pg_dumpall.

- Brandon

----------------------------------------------------------------------------
 c: 917-697-8665                                            h: 201-435-6226
 b. palmer,  bpalmer@crimelabs.net           pgp:crimelabs.net/bpalmer.pgp5