Commit 0de92fd1 authored by Tom Lane's avatar Tom Lane

Improve pg_ctl's man page.

Explicitly document that the -o options of pg_ctl init mode are meant
for initdb, not postgres (Euler Taveira de Oliveira).  Assorted other
copy-editing (Tom).
parent 80fb2c1f
...@@ -25,7 +25,7 @@ PostgreSQL documentation ...@@ -25,7 +25,7 @@ PostgreSQL documentation
<arg choice="plain">init[db]</arg> <arg choice="plain">init[db]</arg>
<arg>-s</arg> <arg>-s</arg>
<arg>-D <replaceable>datadir</replaceable></arg> <arg>-D <replaceable>datadir</replaceable></arg>
<arg>-o <replaceable>options</replaceable></arg> <arg>-o <replaceable>initdb-options</replaceable></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
...@@ -136,8 +136,7 @@ PostgreSQL documentation ...@@ -136,8 +136,7 @@ PostgreSQL documentation
</para> </para>
<para> <para>
The <option>init</option> or <option>initdb</option> mode creates a The <option>init</option> or <option>initdb</option> mode creates a new
new
<productname>PostgreSQL</productname> database cluster. A database <productname>PostgreSQL</productname> database cluster. A database
cluster is a collection of databases that are managed by a single cluster is a collection of databases that are managed by a single
server instance. This mode invokes the <command>initdb</command> server instance. This mode invokes the <command>initdb</command>
...@@ -146,10 +145,10 @@ PostgreSQL documentation ...@@ -146,10 +145,10 @@ PostgreSQL documentation
<para> <para>
In <option>start</option> mode, a new server is launched. The In <option>start</option> mode, a new server is launched. The
server is started in the background, and standard input is attached server is started in the background, and its standard input is attached
to <filename>/dev/null</filename> (or <literal>nul</> on Windows). to <filename>/dev/null</filename> (or <literal>nul</> on Windows).
On Unix-like systems, by default, the server's standard output and On Unix-like systems, by default, the server's standard output and
standard error are send to <application>pg_ctl</application>'s standard error are sent to <application>pg_ctl</application>'s
standard output (not standard error). The standard output of standard output (not standard error). The standard output of
<application>pg_ctl</application> should then be redirected to a <application>pg_ctl</application> should then be redirected to a
file or piped to another process such as a log rotating program file or piped to another process such as a log rotating program
...@@ -157,24 +156,25 @@ PostgreSQL documentation ...@@ -157,24 +156,25 @@ PostgreSQL documentation
will write its output to the controlling terminal (from the will write its output to the controlling terminal (from the
background) and will not leave the shell's process group. On background) and will not leave the shell's process group. On
Windows, by default the server's standard output and standard error Windows, by default the server's standard output and standard error
are sent to the terminal. These default behaviors can be changed are sent to the terminal. These default behaviors can be changed
by using <option>-l</option> to append server output to a log file. by using <option>-l</option> to append the server's output to a log file.
Use of either <option>-l</option> or output redirection is recommended.
</para> </para>
<para> <para>
In <option>stop</option> mode, the server that is running in In <option>stop</option> mode, the server that is running in
the specified data directory is shut down. Three different the specified data directory is shut down. Three different
shutdown methods can be selected with the <option>-m</option> shutdown methods can be selected with the <option>-m</option>
option: <quote>Smart</quote> mode waits for online backup mode option. <quote>Smart</quote> mode (the default) waits for all active
to finish and all the clients to disconnect. This is the default. clients to disconnect and any online backup to finish.
If the server is in recovery, recovery and streaming replication If the server is in hot standby, recovery and streaming replication
will be terminated once all clients have disconnected. will be terminated once all clients have disconnected.
<quote>Fast</quote> mode does not wait for clients to disconnect and <quote>Fast</quote> mode does not wait for clients to disconnect and
will terminate an online backup in progress. All active transactions are will terminate an online backup in progress. All active transactions are
rolled back and clients are forcibly disconnected, then the rolled back and clients are forcibly disconnected, then the
server is shut down. <quote>Immediate</quote> mode will abort server is shut down. <quote>Immediate</quote> mode will abort
all server processes without a clean shutdown. This will lead to all server processes immediately, without a clean shutdown.
a recovery run on restart. This will lead to a crash-recovery run on the next restart.
</para> </para>
<para> <para>
...@@ -203,7 +203,7 @@ PostgreSQL documentation ...@@ -203,7 +203,7 @@ PostgreSQL documentation
<para> <para>
<option>kill</option> mode allows you to send a signal to a specified <option>kill</option> mode allows you to send a signal to a specified
process. This is particularly valuable for <productname>Microsoft Windows</> process. This is particularly valuable for <productname>Microsoft Windows</>
which does not have a <application>kill</> command. Use which does not have a <application>kill</> command. Use
<literal>--help</> to see a list of supported signal names. <literal>--help</> to see a list of supported signal names.
</para> </para>
...@@ -211,12 +211,13 @@ PostgreSQL documentation ...@@ -211,12 +211,13 @@ PostgreSQL documentation
<option>register</option> mode allows you to register a system service <option>register</option> mode allows you to register a system service
on <productname>Microsoft Windows</>. The <option>-S</option> option on <productname>Microsoft Windows</>. The <option>-S</option> option
allows selection of service start type, either <quote>auto</quote> (start allows selection of service start type, either <quote>auto</quote> (start
service automatically on system startup), on <quote>demand</quote>. service automatically on system startup) or <quote>demand</quote> (start
service on demand).
</para> </para>
<para> <para>
<option>unregister</option> mode allows you to unregister a system service <option>unregister</option> mode allows you to unregister a system service
on <productname>Microsoft Windows</>, previously registered with the on <productname>Microsoft Windows</>. This undoes the effects of the
<option>register</option> command. <option>register</option> command.
</para> </para>
</refsect1> </refsect1>
...@@ -231,9 +232,9 @@ PostgreSQL documentation ...@@ -231,9 +232,9 @@ PostgreSQL documentation
<listitem> <listitem>
<para> <para>
Attempt to allow server crashes to produce core files, on platforms Attempt to allow server crashes to produce core files, on platforms
where this available, by lifting any soft resource limit placed on where this is possible, by lifting any soft resource limit placed on
them. core files.
This is useful in debugging or diagnosing problems by allowing a This is useful in debugging or diagnosing problems by allowing a
stack trace to be obtained from a failed server process. stack trace to be obtained from a failed server process.
</para> </para>
</listitem> </listitem>
...@@ -256,8 +257,8 @@ PostgreSQL documentation ...@@ -256,8 +257,8 @@ PostgreSQL documentation
<para> <para>
Append the server log output to Append the server log output to
<replaceable>filename</replaceable>. If the file does not <replaceable>filename</replaceable>. If the file does not
exist, it is created. The <systemitem>umask</> is set to 077, so access to exist, it is created. The <systemitem>umask</> is set to 077,
the log file from other users is disallowed by default. so access to the log file is disallowed to other users by default.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -282,7 +283,21 @@ PostgreSQL documentation ...@@ -282,7 +283,21 @@ PostgreSQL documentation
<command>postgres</command> command. <command>postgres</command> command.
</para> </para>
<para> <para>
The options are usually surrounded by single or double The options should usually be surrounded by single or double
quotes to ensure that they are passed through as a group.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-o <replaceable class="parameter">initdb-options</replaceable></option></term>
<listitem>
<para>
Specifies options to be passed directly to the
<command>initdb</command> command.
</para>
<para>
The options should usually be surrounded by single or double
quotes to ensure that they are passed through as a group. quotes to ensure that they are passed through as a group.
</para> </para>
</listitem> </listitem>
...@@ -312,7 +327,7 @@ PostgreSQL documentation ...@@ -312,7 +327,7 @@ PostgreSQL documentation
<term><option>-s</option></term> <term><option>-s</option></term>
<listitem> <listitem>
<para> <para>
Only print errors, no informational messages. Print only errors, no informational messages.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -321,8 +336,8 @@ PostgreSQL documentation ...@@ -321,8 +336,8 @@ PostgreSQL documentation
<term><option>-t</option></term> <term><option>-t</option></term>
<listitem> <listitem>
<para> <para>
The number of seconds to wait when waiting for start or shutdown The maximum number of seconds to wait when waiting for startup or
to complete. The default is 60 seconds. shutdown to complete. The default is 60 seconds.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -331,19 +346,22 @@ PostgreSQL documentation ...@@ -331,19 +346,22 @@ PostgreSQL documentation
<term><option>-w</option></term> <term><option>-w</option></term>
<listitem> <listitem>
<para> <para>
Wait for the start or shutdown to complete. The default wait time Wait for the startup or shutdown to complete.
is 60 seconds but can be overridden with the option <option>-t</option>. Waiting is the default option for shutdowns, but not startups.
To wait is the default option for shutdowns. A successful When waiting for shutdown, <command>pg_ctl</command> waits for
shutdown is indicated by removal of the <acronym>PID</acronym> the server to remove its <acronym>PID</acronym> file.
file. For starting up, a successful <command>psql -l</command> When waiting for startup, <command>pg_ctl</command> repeatedly
indicates success. <command>pg_ctl</command> will attempt to attempts to connect to the server via <application>psql</>, and
use the proper port for <application>psql</>. If the environment variable reports success when this is successful.
<envar>PGPORT</envar> exists, that is used. Otherwise, it will see if a port <command>pg_ctl</command> will attempt to use the proper port for
has been set in the <filename>postgresql.conf</filename> file. <application>psql</>. If the environment variable
If neither of those is used, it will use the default port that <envar>PGPORT</envar> exists, that is used. Otherwise,
<productname>PostgreSQL</productname> was compiled with <command>pg_ctl</command> will see if a port has been set in the
(5432 by default). When waiting, <command>pg_ctl</command> will <filename>postgresql.conf</filename> file. If not, it will use the
return an accurate exit code based on the success of the startup default port that <productname>PostgreSQL</productname> was compiled
with (5432 by default).
When waiting, <command>pg_ctl</command> will
return an exit code based on the success of the startup
or shutdown. or shutdown.
</para> </para>
</listitem> </listitem>
...@@ -353,8 +371,8 @@ PostgreSQL documentation ...@@ -353,8 +371,8 @@ PostgreSQL documentation
<term><option>-W</option></term> <term><option>-W</option></term>
<listitem> <listitem>
<para> <para>
Do not wait for start or shutdown to complete. This is the Do not wait for startup or shutdown to complete. This is the
default for starts and restarts. default for start and restart modes.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -375,20 +393,20 @@ PostgreSQL documentation ...@@ -375,20 +393,20 @@ PostgreSQL documentation
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-P <replaceable class="parameter">password</replaceable></option></term> <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Password for the user to start the service. User name for the user to start the service. For domain users, use the
format <literal>DOMAIN\username</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-U <replaceable class="parameter">username</replaceable></option></term> <term><option>-P <replaceable class="parameter">password</replaceable></option></term>
<listitem> <listitem>
<para> <para>
User name for the user to start the service. For domain users, use the Password for the user to start the service.
format <literal>DOMAIN\username</literal>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -430,7 +448,7 @@ PostgreSQL documentation ...@@ -430,7 +448,7 @@ PostgreSQL documentation
<listitem> <listitem>
<para> <para>
Default host name or Unix-domain socket location for <xref Default host name or Unix-domain socket location for <xref
linkend="app-psql"> (used by the <option>-w</option> option). linkend="app-psql"> (used when waiting for startup).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -440,7 +458,8 @@ PostgreSQL documentation ...@@ -440,7 +458,8 @@ PostgreSQL documentation
<listitem> <listitem>
<para> <para>
Default port number for <xref linkend="app-psql"> (used by the <option>-w</option> option). Default port number for <xref linkend="app-psql">
(used when waiting for startup).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -448,10 +467,11 @@ PostgreSQL documentation ...@@ -448,10 +467,11 @@ PostgreSQL documentation
</variablelist> </variablelist>
<para> <para>
For additional server variables, see <xref linkend="app-postgres">. <command>pg_ctl</command>, like most other <productname>PostgreSQL</>
This utility, like most other <productname>PostgreSQL</> utilities, utilities,
also uses the environment variables supported by <application>libpq</> also uses the environment variables supported by <application>libpq</>
(see <xref linkend="libpq-envars">). (see <xref linkend="libpq-envars">).
For additional server variables, see <xref linkend="app-postgres">.
</para> </para>
</refsect1> </refsect1>
...@@ -477,10 +497,10 @@ PostgreSQL documentation ...@@ -477,10 +497,10 @@ PostgreSQL documentation
<listitem> <listitem>
<para>If this file exists in the data directory, <para>If this file exists in the data directory,
<application>pg_ctl</application> (in <option>restart</option> mode) <application>pg_ctl</application> (in <option>restart</option> mode)
will pass the contents of the file as options to will pass the contents of the file as options to
<application>postgres</application>, unless overridden <application>postgres</application>, unless overridden
by the <option>-o</option> option. The contents of this file by the <option>-o</option> option. The contents of this file
are also displayed in <option>status</option> mode. are also displayed in <option>status</option> mode.
</para> </para>
</listitem> </listitem>
...@@ -492,8 +512,8 @@ PostgreSQL documentation ...@@ -492,8 +512,8 @@ PostgreSQL documentation
<listitem> <listitem>
<para> <para>
This file, located in the data directory, is parsed to find the This file, located in the data directory, is parsed to find the
proper port to use with <application>psql</application> when the proper port to use with <application>psql</application>
<option>-w</option> is given in <option>start</option> mode. when waiting for startup.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -506,7 +526,7 @@ PostgreSQL documentation ...@@ -506,7 +526,7 @@ PostgreSQL documentation
<title>Notes</title> <title>Notes</title>
<para> <para>
Waiting for complete start is not a well-defined operation and might Waiting for complete startup is not a well-defined operation and might
fail if access control is set up so that a local client cannot fail if access control is set up so that a local client cannot
connect without manual interaction (e.g., password authentication). For connect without manual interaction (e.g., password authentication). For
additional connection variables, see <xref linkend="libpq-envars">, additional connection variables, see <xref linkend="libpq-envars">,
...@@ -571,8 +591,8 @@ PostgreSQL documentation ...@@ -571,8 +591,8 @@ PostgreSQL documentation
</para> </para>
<para> <para>
To restart server, To restart the server,
waiting for it to shut down and to come up: waiting for it to shut down and come up again:
<screen> <screen>
<prompt>$</prompt> <userinput>pg_ctl -w restart</userinput> <prompt>$</prompt> <userinput>pg_ctl -w restart</userinput>
</screen> </screen>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment