initlocation is history. (It's still mentioned in manage-ag.sgml,
but I'll leave that file alone so as not to mess up the doc patch I trust Gavin is working on.)
This commit is contained in:
parent
b33c7231e5
commit
984c8a48f4
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.57 2004/06/18 06:13:05 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.58 2004/06/18 21:24:01 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
Complete list of usable sgml source files in this directory.
|
||||
-->
|
||||
@ -111,7 +111,6 @@ Complete list of usable sgml source files in this directory.
|
||||
<!entity dropuser system "dropuser.sgml">
|
||||
<!entity ecpgRef system "ecpg-ref.sgml">
|
||||
<!entity initdb system "initdb.sgml">
|
||||
<!entity initlocation system "initlocation.sgml">
|
||||
<!entity ipcclean system "ipcclean.sgml">
|
||||
<!entity pgConfig system "pg_config-ref.sgml">
|
||||
<!entity pgControldata system "pg_controldata.sgml">
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/createdb.sgml,v 1.38 2004/03/23 02:47:35 neilc Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/createdb.sgml,v 1.39 2004/06/18 21:24:02 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -90,8 +90,7 @@ PostgreSQL documentation
|
||||
<term><option>--location <replaceable class="parameter">location</replaceable></></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the alternative location for the database. See also <xref
|
||||
linkend="app-initlocation">.
|
||||
Specifies the alternative location for the database.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -1,89 +0,0 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/initlocation.sgml,v 1.22 2003/11/29 19:51:39 pgsql Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
<refentry id="APP-INITLOCATION">
|
||||
<refmeta>
|
||||
<refentrytitle id="APP-INITLOCATION-TITLE"><application>initlocation</application></refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>Application</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>initlocation</refname>
|
||||
<refpurpose>create a secondary <productname>PostgreSQL</productname> database storage area</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<indexterm zone="app-initlocation">
|
||||
<primary>initlocation</primary>
|
||||
</indexterm>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>initlocation</command>
|
||||
<arg choice="plain"><replaceable>directory</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1 id="R1-APP-INITLOCATION-1">
|
||||
<title>Description</title>
|
||||
<para>
|
||||
<application>initlocation</application>
|
||||
creates a new <productname>PostgreSQL</productname> secondary database storage area.
|
||||
See the discussion under <xref linkend="SQL-CREATEDATABASE" endterm="SQL-CREATEDATABASE-title">
|
||||
about how to manage and use secondary storage areas. If the argument does not contain
|
||||
a slash and is not valid as a path, it is assumed to be an environment variable,
|
||||
which is referenced. See the examples at the end.
|
||||
</para>
|
||||
<para>
|
||||
In order to use this command you must be logged in (using <command>su</command>, for example)
|
||||
as the database superuser.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="R1-APP-INITLOCATION-2">
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
To create a database in an alternate location, using an
|
||||
environment variable:
|
||||
<screen>
|
||||
<prompt>$ </prompt><userinput>export PGDATA2=/opt/postgres/data</userinput>
|
||||
</screen>
|
||||
Stop and start <command>postmaster</> so it sees the <envar>PGDATA2</envar>
|
||||
environment variable. The system must be configured so the
|
||||
<command>postmaster</> sees <envar>PGDATA2</envar> every time it starts. Finally:
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>initlocation PGDATA2</userinput>
|
||||
<prompt>$</prompt> <userinput>createdb -D PGDATA2 testdb</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Alternatively, if you allow absolute paths you could write:
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>initlocation /opt/postgres/data</userinput>
|
||||
<prompt>$</prompt> <userinput>createdb -D /opt/postgres/data/testdb testdb</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:nil
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../reference.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog"
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
@ -1,5 +1,5 @@
|
||||
<!-- reference.sgml
|
||||
$PostgreSQL: pgsql/doc/src/sgml/reference.sgml,v 1.48 2004/06/18 06:13:02 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/reference.sgml,v 1.49 2004/06/18 21:24:04 tgl Exp $
|
||||
|
||||
PostgreSQL Reference Manual
|
||||
-->
|
||||
@ -180,7 +180,6 @@ PostgreSQL Reference Manual
|
||||
</partintro>
|
||||
|
||||
&initdb;
|
||||
&initlocation;
|
||||
&ipcclean;
|
||||
&pgControldata;
|
||||
&pgCtl;
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/bin/Makefile,v 1.43 2004/04/20 00:40:06 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/bin/Makefile,v 1.44 2004/06/18 21:24:05 tgl Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -13,7 +13,7 @@ subdir = src/bin
|
||||
top_builddir = ../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
DIRS := initdb initlocation ipcclean pg_ctl pg_dump \
|
||||
DIRS := initdb ipcclean pg_ctl pg_dump \
|
||||
psql scripts pg_config pg_controldata pg_resetxlog
|
||||
|
||||
all install installdirs uninstall depend distprep:
|
||||
|
@ -1,32 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile for src/bin/initlocation
|
||||
#
|
||||
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/bin/initlocation/Makefile,v 1.15 2003/11/29 19:52:04 pgsql Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
subdir = src/bin/initlocation
|
||||
top_builddir = ../../..
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
all: initlocation
|
||||
|
||||
initlocation: initlocation.sh
|
||||
cp $< $@
|
||||
chmod a+x $@
|
||||
|
||||
install: all installdirs
|
||||
$(INSTALL_SCRIPT) initlocation $(DESTDIR)$(bindir)/initlocation
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(bindir)/initlocation
|
||||
|
||||
clean distclean maintainer-clean:
|
||||
rm -f initlocation
|
@ -1,171 +0,0 @@
|
||||
#!/bin/sh
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# initlocation.sh--
|
||||
# Create a secondary PostgreSQL database storage area.
|
||||
#
|
||||
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $PostgreSQL: pgsql/src/bin/initlocation/initlocation.sh,v 1.17 2003/11/29 19:52:04 pgsql Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
exit_nicely(){
|
||||
echo "$CMDNAME: failed" 1>&2
|
||||
rm -rf "$PGALTDATA"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
CMDNAME=`basename $0`
|
||||
EffectiveUser=`id -n -u 2>/dev/null || whoami 2>/dev/null`
|
||||
|
||||
if [ "$USER" = 'root' -o "$LOGNAME" = 'root' ]
|
||||
then
|
||||
echo "$CMDNAME: cannot be run as root" 1>&2
|
||||
echo "Please log in (using, e.g., \"su\") as the (unprivileged) user that will" 1>&2
|
||||
echo "own the server process." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Location=
|
||||
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
# These options are not really necessary, but what the heck.
|
||||
--location=*)
|
||||
Location=`echo $1 | sed 's/^--pgdata=//'`
|
||||
;;
|
||||
--location)
|
||||
Location="$2"
|
||||
shift;;
|
||||
-D)
|
||||
Location="$2"
|
||||
shift;;
|
||||
|
||||
--help|-\?)
|
||||
usage=t
|
||||
break;;
|
||||
|
||||
-*)
|
||||
echo "$CMDNAME: invalid option: $1" 1>&2
|
||||
echo "Try \"$CMDNAME --help\" for more information." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
Location="$1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
if [ "$usage" ]; then
|
||||
echo "$CMDNAME initializes an alternative filesystem location for database"
|
||||
echo "creation."
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $CMDNAME LOCATION"
|
||||
echo
|
||||
echo "Please read the description of the CREATE DATABASE command for details."
|
||||
echo
|
||||
echo "Report bugs to <pgsql-bugs@postgresql.org>."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "$Location" ]; then
|
||||
echo "$CMDNAME: missing required argument LOCATION" 1>&2
|
||||
echo "Try \"$CMDNAME --help\" for more information." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Here's what's going on:
|
||||
#
|
||||
# You can call initlocation ENVAR (no dollar sign), then ENVAR will
|
||||
# (a) be tested whether it is valid as a path, or
|
||||
# (b) be resolved as an environment variable.
|
||||
# The latter has been the traditional behaviour.
|
||||
#
|
||||
# You can call initlocation $ENVAR, which will of course be resolved
|
||||
# by the shell, or initlocation some/path (containing at least one slash).
|
||||
# Then you just take that path.
|
||||
# This should appease users who are confused by the above behavour.
|
||||
#
|
||||
|
||||
echo "$Location" | grep '/' >/dev/null 2>&1
|
||||
|
||||
if [ "$?" -ne 0 -a ! -d "$Location" ]; then
|
||||
PGALTDATA=`printenv $Location 2> /dev/null`
|
||||
if [ -z "$PGALTDATA" ]; then
|
||||
echo "$CMDNAME: environment variable $Location not set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
haveenv=t
|
||||
else
|
||||
PGALTDATA="$Location"
|
||||
haveenv=f
|
||||
fi
|
||||
|
||||
echo "The files belonging to this location will be owned by user \"$EffectiveUser\"."
|
||||
echo "This user must also own the server process."
|
||||
echo
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Create the data directory if necessary
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
# don't want to leave anything lying around
|
||||
trap 'echo "Caught signal." ; exit_nicely' 1 2 3 15
|
||||
|
||||
# umask must disallow access to group, other for files and dirs
|
||||
umask 077
|
||||
|
||||
if [ ! -d "$PGALTDATA" ]; then
|
||||
echo "creating directory $PGALTDATA"
|
||||
mkdir "$PGALTDATA"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "$CMDNAME: could not create directory \"$PGALTDATA\"" 1>&2
|
||||
echo "Make sure \"$PGALTDATA\" is a valid path and that you have permission to access it." 1>&2
|
||||
exit_nicely
|
||||
fi
|
||||
else
|
||||
echo "fixing permissions on pre-existing directory $PGALTDATA"
|
||||
chmod go-rwx "$PGALTDATA" || exit_nicely
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d "$PGALTDATA"/base ]; then
|
||||
echo "creating directory $PGALTDATA/base"
|
||||
mkdir "$PGALTDATA/base"
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "$CMDNAME: could not create $PGALTDATA/base" 1>&2
|
||||
echo "Make sure \"$PGALTDATA/base\" is a valid path and that you have permission to access it." 1>&2
|
||||
exit_nicely
|
||||
fi
|
||||
else
|
||||
echo "fixing permissions on pre-existing directory $PGALTDATA/base"
|
||||
chmod go-rwx "$PGALTDATA/base" || exit_nicely
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "$CMDNAME is complete."
|
||||
# We can only suggest them these commands if they used the environment
|
||||
# variable notation. Otherwise they would be induced to use an absolute
|
||||
# path, which the backend won't allow by default.
|
||||
if [ "$haveenv" = "t" ]; then
|
||||
echo "You can now create a database using"
|
||||
echo " CREATE DATABASE <name> WITH LOCATION = '$Location'"
|
||||
echo "in SQL, or"
|
||||
echo " createdb -D '$Location' <name>"
|
||||
echo "from the shell."
|
||||
fi
|
||||
echo
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user