OSDN Git Service

b52e655f7f13059b200b9a50c7f5060beb8aeaec
[pg-rex/syncrep.git] / src / bin / initdb / initdb.sh
1 #! /bin/sh
2 #-------------------------------------------------------------------------
3 #
4 # initdb creates (initializes) a PostgreSQL database cluster (site,
5 # instance, installation, whatever).  A database cluster is a
6 # collection of PostgreSQL databases all managed by the same postmaster.
7 #
8 # To create the database cluster, we create the directory that contains
9 # all its data, create the files that hold the global tables, create
10 # a few other control files for it, and create two databases: the
11 # template0 and template1 databases.
12 #
13 # The template databases are ordinary PostgreSQL databases.  template0
14 # is never supposed to change after initdb, whereas template1 can be
15 # changed to add site-local standard data.  Either one can be copied
16 # to produce a new database.
17 #
18 # To create template1, we run the postgres (backend) program and
19 # feed it data from the bki files that were installed.  template0 is
20 # made just by copying the completed template1.
21 #
22 #
23 # Copyright (c) 1994, Regents of the University of California
24 #
25 # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.120 2001/01/20 22:09:24 tgl Exp $
26 #
27 #-------------------------------------------------------------------------
28
29
30 ##########################################################################
31 #
32 # INITIALIZATION
33
34 exit_nicely(){
35     stty echo > /dev/null 2>&1
36     echo 1>&2
37     echo "$CMDNAME failed." 1>&2
38     if [ "$noclean" != yes ]; then
39         if [ "$made_new_pgdata" = yes ]; then
40             echo "Removing $PGDATA." 1>&2
41             rm -rf "$PGDATA" || echo "Failed." 1>&2
42         fi
43         echo "Removing temp file $TEMPFILE." 1>&2
44         rm -rf "$TEMPFILE" || echo "Failed." 1>&2
45     else
46         echo "Data directory $PGDATA will not be removed at user's request." 1>&2
47     fi
48     exit 1
49 }
50
51
52 CMDNAME=`basename $0`
53
54 # Placed here during build
55 VERSION='@VERSION@'
56 bindir='@bindir@'
57 # Note that "datadir" is not the directory we're initializing, it's
58 # merely how Autoconf names PREFIX/share.
59 datadir='@datadir@'
60 # as set by configure --enable-multibyte[=XXX].
61 MULTIBYTE='@MULTIBYTE@'
62
63 if [ "$TMPDIR" ]; then
64     TEMPFILE="$TMPDIR/initdb.$$"
65 else
66     TEMPFILE="/tmp/initdb.$$"
67 fi
68
69
70 # Check for echo -n vs echo \c
71 if echo '\c' | grep -s c >/dev/null 2>&1
72 then
73     ECHO_N="echo -n"
74     ECHO_C=""
75 else
76     ECHO_N="echo"
77     ECHO_C='\c'
78 fi
79
80
81 #
82 # Find out where we're located
83 #
84 if echo "$0" | grep '/' > /dev/null 2>&1 
85 then
86         # explicit dir name given
87         self_path=`echo $0 | sed 's,/[^/]*$,,'`       # (dirname command is not portable)
88 else
89         # look for it in PATH ('which' command is not portable)
90         for dir in `echo "$PATH" | sed 's/:/ /g'`
91         do
92                 # empty entry in path means current dir
93                 [ -z "$dir" ] && dir='.'
94                 if [ -f "$dir/$CMDNAME" ]
95                 then
96                         self_path="$dir"
97                         break
98                 fi
99         done
100 fi
101
102
103 # Check for right version of backend.  First we check for an
104 # executable in the same directory is this initdb script (presuming
105 # the above code worked).  Then we fall back to the hard-wired bindir.
106 # We do it in this order because during upgrades users might move
107 # their trees to backup places, so $bindir might be inaccurate.
108
109 if [ x"$self_path" != x"" ] \
110   && [ -x "$self_path/postgres" ] \
111   && [ x"`$self_path/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
112 then
113     PGPATH=$self_path
114 elif [ -x "$bindir/postgres" ]; then
115     if [ x"`$bindir/postgres -V 2>/dev/null`" = x"postgres (PostgreSQL) $VERSION" ]
116     then
117         PGPATH=$bindir
118     else
119         echo "The program '$bindir/postgres' needed by $CMDNAME does not belong to" 1>&2
120         echo "PostgreSQL version $VERSION.  Check your installation." 1>&2
121         exit 1
122     fi
123 else
124     echo "The program 'postgres' is needed by $CMDNAME but was not found in" 1>&2
125     echo "the directory '$bindir'.  Check your installation." 1>&2
126     exit 1
127 fi
128
129
130 # Now we can assume that 'pg_id' belongs to the same version as the
131 # verified 'postgres' in the same directory.
132 if [ ! -x "$PGPATH/pg_id" ]; then
133     echo "The program 'pg_id' is needed by $CMDNAME but was not found in" 1>&2
134     echo "the directory '$PGPATH'.  Check your installation." 1>&2
135     exit 1
136 fi
137
138
139 EffectiveUser=`$PGPATH/pg_id -n -u`
140 if [ -z "$EffectiveUser" ]; then
141     echo "$CMDNAME: could not determine current user name" 1>&2
142     exit 1
143 fi
144
145 if [ `$PGPATH/pg_id -u` -eq 0 ]
146 then
147     echo "You cannot run $CMDNAME as root. Please log in (using, e.g., 'su')" 1>&2
148     echo "as the (unprivileged) user that will own the server process." 1>&2
149     exit 1
150 fi
151
152
153 short_version=`echo $VERSION | sed -e 's!^\([0-9][0-9]*\.[0-9][0-9]*\).*!\1!'`
154 if [ x"$short_version" = x"" ] ; then
155   echo "$CMDNAME: bug: version number has wrong format" 1>&2
156   exit 1
157 fi
158
159
160 ##########################################################################
161 #
162 # COMMAND LINE OPTIONS
163
164 # 0 is the default (non-)encoding
165 MULTIBYTEID=0
166
167 # Set defaults:
168 debug=
169 noclean=
170 show_setting=
171
172 # Note: There is a single compelling reason that the name of the database
173 #       superuser be the same as the Unix user owning the server process:
174 #       The single user postgres backend will only connect as the database
175 #       user with the same name as the Unix user running it. That's
176 #       a security measure.
177 POSTGRES_SUPERUSERNAME="$EffectiveUser"
178 POSTGRES_SUPERUSERID=`$PGPATH/pg_id -u`
179
180 while [ "$#" -gt 0 ]
181 do
182     case "$1" in
183         --help|-\?)
184                 usage=t
185                 break
186                 ;;
187         --version|-V)
188                 echo "initdb (PostgreSQL) $VERSION"
189                 exit 0
190                 ;;
191         --debug|-d)
192                 debug=yes
193                 echo "Running with debug mode on."
194                 ;;
195         --show|-s)
196                 show_setting=yes
197                 ;;        
198         --noclean|-n)
199                 noclean=yes
200                 echo "Running with noclean mode on. Mistakes will not be cleaned up."
201                 ;;
202 # The sysid of the database superuser. Can be freely changed.
203         --sysid|-i)
204                 POSTGRES_SUPERUSERID="$2"
205                 shift;;
206         --sysid=*)
207                 POSTGRES_SUPERUSERID=`echo $1 | sed 's/^--sysid=//'`
208                 ;;
209         -i*)
210                 POSTGRES_SUPERUSERID=`echo $1 | sed 's/^-i//'`
211                 ;;
212 # The default password of the database superuser.
213 # Make initdb prompt for the default password of the database superuser.
214         --pwprompt|-W)
215                 PwPrompt=1
216                 ;;
217 # Directory where to install the data. No default, unless the environment
218 # variable PGDATA is set.
219         --pgdata|-D)
220                 PGDATA="$2"
221                 shift;;
222         --pgdata=*)
223                 PGDATA=`echo $1 | sed 's/^--pgdata=//'`
224                 ;;
225         -D*)
226                 PGDATA=`echo $1 | sed 's/^-D//'`
227                 ;;
228 # The directory where the .bki input files are stored. Normally
229 # they are in PREFIX/share and this option should be unnecessary.
230         -L)
231                 datadir="$2"
232                 shift;;
233         -L*)
234                 datadir=`echo $1 | sed 's/^-L//'`
235                 ;;
236 # The encoding of the template1 database. Defaults to what you chose
237 # at configure time. (see above)
238         --encoding|-E)
239                 MULTIBYTE="$2"
240                 shift;;
241         --encoding=*)
242                 MULTIBYTE=`echo $1 | sed 's/^--encoding=//'`
243                 ;;
244         -E*)
245                 MULTIBYTE=`echo $1 | sed 's/^-E//'`
246                 ;;
247         -*)
248                 echo "$CMDNAME: invalid option: $1"
249                 echo "Try '$CMDNAME --help' for more information."
250                 exit 1
251                 ;;
252         *)
253                 PGDATA=$1
254                 ;;
255     esac
256     shift
257 done
258
259 if [ "$usage" ]; then
260     echo "$CMDNAME initializes a PostgreSQL database cluster."
261     echo
262     echo "Usage:"
263     echo "  $CMDNAME [options] datadir"
264     echo
265     echo "Options:"
266     echo " [-D, --pgdata] DATADIR       Location for this database cluster"
267     echo "  -W, --pwprompt              Prompt for a password for the new superuser"
268     if [ -n "$MULTIBYTE" ] ; then 
269         echo "  -E, --encoding ENCODING     Set the default multibyte encoding for new databases"
270     fi
271     echo "  -i, --sysid SYSID           Database sysid for the superuser"
272     echo "Less commonly used options: "
273     echo "  -L DIRECTORY                Where to find the input files"
274     echo "  -d, --debug                 Generate lots of debugging output"
275     echo "  -n, --noclean               Do not clean up after errors"
276     echo
277     echo "Report bugs to <pgsql-bugs@postgresql.org>."
278     exit 0
279 fi
280
281 #-------------------------------------------------------------------------
282 # Resolve the multibyte encoding name
283 #-------------------------------------------------------------------------
284
285 if [ "$MULTIBYTE" ]
286 then
287         MULTIBYTEID=`$PGPATH/pg_encoding $MULTIBYTE`
288         if [ "$?" -ne 0 ]
289         then
290               (
291                 echo "$CMDNAME: pg_encoding failed"
292                 echo
293                 echo "Perhaps you did not configure PostgreSQL for multibyte support or"
294                 echo "the program was not successfully installed."
295               ) 1>&2
296                 exit 1
297         fi
298         if [ -z "$MULTIBYTEID" ]
299         then
300                 echo "$CMDNAME: $MULTIBYTE is not a valid encoding name" 1>&2
301                 exit 1
302         fi
303 fi
304
305
306 #-------------------------------------------------------------------------
307 # Make sure he told us where to build the database system
308 #-------------------------------------------------------------------------
309
310 if [ -z "$PGDATA" ]
311 then
312   (
313     echo "$CMDNAME: You must identify where the the data for this database"
314     echo "system will reside.  Do this with either a -D invocation"
315     echo "option or a PGDATA environment variable."
316   ) 1>&2
317     exit 1
318 fi
319
320
321 #-------------------------------------------------------------------------
322 # Find the input files
323 #-------------------------------------------------------------------------
324
325 TEMPLATE1_BKI="$datadir"/template1.bki
326 GLOBAL_BKI="$datadir"/global.bki
327
328 TEMPLATE1_DESCR="$datadir"/template1.description
329 GLOBAL_DESCR="$datadir"/global.description
330
331 PG_HBA_SAMPLE="$datadir"/pg_hba.conf.sample
332 PG_IDENT_SAMPLE="$datadir"/pg_ident.conf.sample
333 POSTGRESQL_CONF_SAMPLE="$datadir"/postgresql.conf.sample
334
335 if [ "$show_setting" = yes ] || [ "$debug" = yes ]
336 then
337     echo
338     echo "Initdb variables:"
339     for var in PGDATA datadir PGPATH TEMPFILE MULTIBYTE MULTIBYTEID \
340         POSTGRES_SUPERUSERNAME POSTGRES_SUPERUSERID TEMPLATE1_BKI GLOBAL_BKI \
341         TEMPLATE1_DESCR GLOBAL_DESCR POSTGRESQL_CONF_SAMPLE \
342         PG_HBA_SAMPLE PG_IDENT_SAMPLE ; do
343         eval "echo '  '$var=\$$var"
344     done
345 fi
346
347 if [ "$show_setting" = yes ] ; then
348     exit 0
349 fi
350
351 for PREREQ_FILE in "$TEMPLATE1_BKI" "$GLOBAL_BKI" "$PG_HBA_SAMPLE" \
352     "$PG_IDENT_SAMPLE"
353 do
354     if [ ! -f "$PREREQ_FILE" ] ; then
355       (
356         echo "$CMDNAME does not find the file '$PREREQ_FILE'."
357         echo "This means you have a corrupted installation or identified the"
358         echo "wrong directory with the -L invocation option."
359       ) 1>&2
360         exit 1
361     fi
362 done
363
364 for file in "$TEMPLATE1_BKI" "$GLOBAL_BKI"; do
365      if [ x"`sed 1q $file`" != x"# PostgreSQL $short_version" ]; then
366        (
367          echo "The input file '$file' needed by $CMDNAME does not"
368          echo "belong to PostgreSQL $VERSION.  Check your installation or specify the"
369          echo "correct path using the -L option."
370        ) 1>&2
371          exit 1
372      fi
373 done
374
375
376 trap 'echo "Caught signal." ; exit_nicely' 1 2 3 15
377
378 # Let's go
379 echo "This database system will be initialized with username \"$POSTGRES_SUPERUSERNAME\"."
380 echo "This user will own all the data files and must also own the server process."
381 echo
382
383
384 ##########################################################################
385 #
386 # CREATE DATABASE DIRECTORY
387
388 # umask must disallow access to group, other for files and dirs
389 umask 077
390
391 # find out if directory is empty
392 pgdata_contents=`ls -A "$PGDATA" 2>/dev/null`
393 if [ x"$pgdata_contents" != x ]
394 then
395     (
396       echo "$CMDNAME: The directory $PGDATA exists but is not empty."
397       echo "If you want to create a new database system, either remove or empty"
398       echo "the directory $PGDATA or run initdb with"
399       echo "an argument other than $PGDATA."
400     ) 1>&2
401     exit 1
402 else
403     if [ ! -d "$PGDATA" ]; then
404         echo "Creating directory $PGDATA"
405         mkdir -p "$PGDATA" >/dev/null 2>&1 || mkdir "$PGDATA" || exit_nicely
406         made_new_pgdata=yes
407     else
408         echo "Fixing permissions on existing directory $PGDATA"
409         chmod go-rwx "$PGDATA" || exit_nicely
410     fi
411
412     if [ ! -d "$PGDATA"/base ]
413         then
414         echo "Creating directory $PGDATA/base"
415         mkdir "$PGDATA"/base || exit_nicely
416     fi
417     if [ ! -d "$PGDATA"/global ]
418     then
419         echo "Creating directory $PGDATA/global"
420         mkdir "$PGDATA"/global || exit_nicely
421     fi
422     if [ ! -d "$PGDATA"/pg_xlog ]
423     then
424         echo "Creating directory $PGDATA/pg_xlog"
425         mkdir "$PGDATA"/pg_xlog || exit_nicely
426     fi
427 fi
428
429
430 ##########################################################################
431 #
432 # CREATE TEMPLATE1 DATABASE
433
434 rm -rf "$PGDATA"/base/1 || exit_nicely
435 mkdir "$PGDATA"/base/1 || exit_nicely
436
437 if [ "$debug" = yes ]
438 then
439     BACKEND_TALK_ARG="-d"
440 else
441     BACKEND_TALK_ARG="-Q"
442 fi
443
444 BACKENDARGS="-boot -C -F -D$PGDATA $BACKEND_TALK_ARG"
445 FIRSTRUN="-boot -x1 -C -F -D$PGDATA $BACKEND_TALK_ARG"
446
447 echo "Creating template1 database in $PGDATA/base/1"
448 [ "$debug" = yes ] && echo "Running: $PGPATH/postgres $FIRSTRUN template1"
449
450 cat "$TEMPLATE1_BKI" \
451 | sed -e "s/PGUID/$POSTGRES_SUPERUSERID/g" \
452 | "$PGPATH"/postgres $FIRSTRUN template1 \
453 || exit_nicely
454
455 echo $short_version > "$PGDATA"/base/1/PG_VERSION || exit_nicely
456
457
458 ##########################################################################
459 #
460 # CREATE GLOBAL TABLES
461 #
462
463 echo "Creating global relations in $PGDATA/global"
464
465 [ "$debug" = yes ] && echo "Running: $PGPATH/postgres $BACKENDARGS template1"
466
467 cat "$GLOBAL_BKI" \
468 | sed -e "s/POSTGRES/$POSTGRES_SUPERUSERNAME/g" \
469       -e "s/PGUID/$POSTGRES_SUPERUSERID/g" \
470       -e "s/ENCODING/$MULTIBYTEID/g" \
471 | "$PGPATH"/postgres $BACKENDARGS template1 \
472 || exit_nicely
473
474 echo $short_version > "$PGDATA/PG_VERSION" || exit_nicely
475
476 cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf              || exit_nicely
477 cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf          || exit_nicely
478 cp "$POSTGRESQL_CONF_SAMPLE" "$PGDATA"/postgresql.conf || exit_nicely
479 chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \
480         "$PGDATA"/postgresql.conf
481
482
483 ##########################################################################
484 #
485 # CREATE VIEWS and other things
486
487 echo "Initializing pg_shadow."
488
489 PGSQL_OPT="-o /dev/null -O -F -D$PGDATA"
490
491 # Create a trigger so that direct updates to pg_shadow will be written
492 # to the flat password file pg_pwd
493 echo "CREATE TRIGGER pg_sync_pg_pwd AFTER INSERT OR UPDATE OR DELETE ON pg_shadow" \
494      "FOR EACH ROW EXECUTE PROCEDURE update_pg_pwd()" \
495      | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
496
497 # needs to be done before alter user
498 echo "REVOKE ALL on pg_shadow FROM public" \
499         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
500
501 # set up password
502 if [ "$PwPrompt" ]; then
503     $ECHO_N "Enter new superuser password: "$ECHO_C
504     stty -echo > /dev/null 2>&1
505     read FirstPw
506     stty echo > /dev/null 2>&1
507     echo
508     $ECHO_N "Enter it again: "$ECHO_C
509     stty -echo > /dev/null 2>&1
510     read SecondPw
511     stty echo > /dev/null 2>&1
512     echo
513     if [ "$FirstPw" != "$SecondPw" ]; then
514         echo "Passwords didn't match." 1>&2
515         exit_nicely
516     fi
517     echo "ALTER USER \"$POSTGRES_SUPERUSERNAME\" WITH PASSWORD '$FirstPw'" \
518         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
519     if [ ! -f $PGDATA/global/pg_pwd ]; then
520         echo "The password file wasn't generated. Please report this problem." 1>&2
521         exit_nicely
522     fi
523     echo "Setting password"
524 fi
525
526
527 echo "Enabling unlimited row width for system tables."
528
529 echo "ALTER TABLE pg_attrdef CREATE TOAST TABLE" \
530         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
531 echo "ALTER TABLE pg_description CREATE TOAST TABLE" \
532         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
533 echo "ALTER TABLE pg_proc CREATE TOAST TABLE" \
534         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
535 echo "ALTER TABLE pg_relcheck CREATE TOAST TABLE" \
536         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
537 echo "ALTER TABLE pg_rewrite CREATE TOAST TABLE" \
538         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
539 echo "ALTER TABLE pg_statistic CREATE TOAST TABLE" \
540         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
541
542
543 echo "Creating system views."
544
545 echo "CREATE VIEW pg_user AS \
546         SELECT \
547             usename, \
548             usesysid, \
549             usecreatedb, \
550             usetrace, \
551             usesuper, \
552             usecatupd, \
553             '********'::text as passwd, \
554             valuntil \
555         FROM pg_shadow" \
556         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
557
558 echo "CREATE VIEW pg_rules AS \
559         SELECT \
560             C.relname AS tablename, \
561             R.rulename AS rulename, \
562             pg_get_ruledef(R.rulename) AS definition \
563         FROM pg_rewrite R, pg_class C \
564         WHERE R.rulename !~ '^_RET' \
565             AND C.oid = R.ev_class;" \
566         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
567
568 echo "CREATE VIEW pg_views AS \
569         SELECT \
570             C.relname AS viewname, \
571             pg_get_userbyid(C.relowner) AS viewowner, \
572             pg_get_viewdef(C.relname) AS definition \
573         FROM pg_class C \
574         WHERE C.relkind = 'v';" \
575         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
576
577 # XXX why does pg_tables include sequences?
578
579 echo "CREATE VIEW pg_tables AS \
580         SELECT \
581             C.relname AS tablename, \
582             pg_get_userbyid(C.relowner) AS tableowner, \
583             C.relhasindex AS hasindexes, \
584             C.relhasrules AS hasrules, \
585             (C.reltriggers > 0) AS hastriggers \
586         FROM pg_class C \
587         WHERE C.relkind IN ('r', 's');" \
588         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
589
590 echo "CREATE VIEW pg_indexes AS \
591         SELECT \
592             C.relname AS tablename, \
593             I.relname AS indexname, \
594             pg_get_indexdef(X.indexrelid) AS indexdef \
595         FROM pg_index X, pg_class C, pg_class I \
596         WHERE C.relkind = 'r' AND I.relkind = 'i' \
597             AND C.oid = X.indrelid \
598             AND I.oid = X.indexrelid;" \
599         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
600
601 echo "Loading pg_description."
602 echo "COPY pg_description FROM STDIN" > $TEMPFILE
603 cat "$TEMPLATE1_DESCR" >> $TEMPFILE
604 cat "$GLOBAL_DESCR" >> $TEMPFILE
605
606 cat $TEMPFILE \
607         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
608 rm -f "$TEMPFILE" || exit_nicely
609
610 echo "Setting lastsysoid."
611 echo "UPDATE pg_database SET \
612         datistemplate = 't', \
613         datlastsysoid = (SELECT max(oid) FROM pg_description) \
614         WHERE datname = 'template1'" \
615                 | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
616
617 echo "Vacuuming database."
618 echo "VACUUM ANALYZE" \
619         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
620
621 echo "Copying template1 to template0."
622 echo "CREATE DATABASE template0" \
623         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
624 echo "UPDATE pg_database SET \
625         datistemplate = 't', \
626         datallowconn = 'f' \
627         WHERE datname = 'template0'" \
628                 | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
629 echo "VACUUM pg_database" \
630         | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely
631
632
633 ##########################################################################
634 #
635 # FINISHED
636
637 echo
638 echo "Success. You can now start the database server using:"
639 echo ""
640 echo "  $PGPATH/postmaster -D $PGDATA"
641 echo "or"
642 echo "  $PGPATH/pg_ctl -D $PGDATA start"
643 echo
644
645 exit 0