head	1.52;
access;
symbols
	REL9_0_0:1.51.2.1
	REL9_1_ALPHA1:1.52
	REL9_0_RC1:1.51.2.1
	REL9_0_BETA4:1.51
	REL9_0_STABLE:1.51.0.2
	REL9_0_BETA3:1.51
	REL9_0_BETA2:1.50
	REL7_4_29:1.24
	REL8_0_25:1.30.4.1
	REL8_1_21:1.32
	REL8_2_17:1.35.2.2
	REL8_3_11:1.44
	REL8_4_4:1.46
	REL9_0_BETA1:1.50
	REL9_0_ALPHA5_BRANCH:1.48.0.2
	REL9_0_ALPHA5:1.48
	REL7_4_28:1.24
	REL8_0_24:1.30.4.1
	REL8_1_20:1.32
	REL8_2_16:1.35.2.2
	REL8_3_10:1.44
	REL8_4_3:1.46
	REL9_0_ALPHA4:1.47
	REL9_0_ALPHA4_BRANCH:1.47.0.4
	REL8_5_ALPHA3:1.47
	REL8_5_ALPHA3_BRANCH:1.47.0.2
	REL7_4_27:1.24
	REL8_0_23:1.30.4.1
	REL8_1_19:1.32
	REL8_2_15:1.35.2.2
	REL8_3_9:1.44
	REL8_4_2:1.46
	REL8_5_ALPHA2:1.46
	REL8_5_ALPHA2_BRANCH:1.46.0.6
	REL7_4_26:1.24
	REL8_0_22:1.30.4.1
	REL8_1_18:1.32
	REL8_2_14:1.35.2.2
	REL8_3_8:1.44
	REL8_4_1:1.46
	REL8_5_ALPHA1:1.46
	REL8_5_ALPHA1_BRANCH:1.46.0.4
	REL8_4_STABLE:1.46.0.2
	REL8_4_0:1.46
	REL8_4_RC2:1.46
	REL8_4_RC1:1.46
	REL8_4_BETA2:1.46
	REL8_4_BETA1:1.46
	REL7_4_25:1.24
	REL8_0_21:1.30.4.1
	REL8_1_17:1.32
	REL8_2_13:1.35.2.2
	REL8_3_7:1.44
	REL7_4_24:1.24
	REL8_0_20:1.30.4.1
	REL8_1_16:1.32
	REL8_2_12:1.35.2.2
	REL8_3_6:1.44
	REL7_4_23:1.24
	REL8_0_19:1.30.4.1
	REL8_1_15:1.32
	REL8_2_11:1.35.2.2
	REL8_3_5:1.44
	REL7_4_22:1.24
	REL8_0_18:1.30.4.1
	REL8_1_14:1.32
	REL8_2_10:1.35.2.2
	REL8_3_4:1.44
	REL7_4_21:1.24
	REL8_0_17:1.30.4.1
	REL8_1_13:1.32
	REL8_2_9:1.35.2.2
	REL8_3_3:1.44
	REL7_4_20:1.24
	REL8_0_16:1.30.4.1
	REL8_1_12:1.32
	REL8_2_8:1.35.2.2
	REL8_3_2:1.44
	REL8_2_7:1.35.2.2
	REL8_3_1:1.44
	REL8_3_STABLE:1.44.0.2
	REL8_3_0:1.44
	REL8_3_RC2:1.44
	REL7_3_21:1.17
	REL7_4_19:1.24
	REL8_0_15:1.30.4.1
	REL8_1_11:1.32
	REL8_2_6:1.35.2.2
	REL8_3_RC1:1.44
	REL8_3_BETA4:1.44
	REL8_3_BETA3:1.44
	REL8_3_BETA2:1.41
	REL8_3_BETA1:1.41
	REL7_3_20:1.17
	REL7_4_18:1.24
	REL8_0_14:1.30.4.1
	REL8_1_10:1.32
	REL8_2_5:1.35.2.2
	REL7_3_19:1.17
	REL7_4_17:1.24
	REL8_0_13:1.30.4.1
	REL8_1_9:1.32
	REL8_2_4:1.35.2.2
	REL8_0_12:1.30.4.1
	REL8_1_8:1.32
	REL8_2_3:1.35
	REL7_3_18:1.17
	REL7_4_16:1.24
	REL8_0_11:1.30.4.1
	REL8_1_7:1.32
	REL8_2_2:1.35
	REL8_0_10:1.30.4.1
	REL8_1_6:1.32
	REL8_2_1:1.35
	REL7_4_15:1.24
	REL7_3_17:1.17
	REL8_2_STABLE:1.35.0.2
	REL8_2_0:1.35
	REL8_2_RC1:1.34
	REL8_2_BETA3:1.34
	REL8_2_BETA2:1.34
	REL8_1_5:1.32
	REL8_0_9:1.30.4.1
	REL7_4_14:1.24
	REL7_3_16:1.17
	REL8_2_BETA1:1.34
	REL7_3_15:1.17
	REL7_4_13:1.24
	REL8_0_8:1.30.4.1
	REL8_1_4:1.32
	REL7_3_14:1.17
	REL7_4_12:1.24
	REL8_0_7:1.30.4.1
	REL8_1_3:1.32
	REL7_3_13:1.17
	REL7_4_11:1.24
	REL8_0_6:1.30.4.1
	REL8_1_2:1.32
	REL7_3_12:1.17
	REL7_4_10:1.24
	REL8_0_5:1.30.4.1
	REL8_1_1:1.32
	REL8_1_STABLE:1.32.0.2
	REL8_1_0:1.32
	REL8_1_0RC1:1.31
	REL8_1_0BETA4:1.31
	REL8_1_0BETA3:1.31
	REL7_3_11:1.17
	REL7_4_9:1.24
	REL8_0_4:1.30.4.1
	REL8_1_0BETA2:1.31
	REL8_1_0BETA1:1.31
	REL7_2_8:1.12
	REL7_3_10:1.17
	REL7_4_8:1.24
	REL8_0_3:1.30.4.1
	REL8_0_2:1.30.4.1
	REL7_2_7:1.12
	REL7_3_9:1.17
	REL7_4_7:1.24
	REL8_0_1:1.30
	REL8_0_STABLE:1.30.0.4
	REL8_0_0:1.30.0.2
	REL8_0_0RC5:1.30
	REL8_0_0RC4:1.30
	REL8_0_0RC3:1.30
	REL8_0_0RC2:1.29
	REL8_0_0RC1:1.29
	REL8_0_0BETA5:1.28
	REL8_0_0BETA4:1.28
	REL7_4_6:1.24
	REL7_3_8:1.17
	REL7_2_6:1.12
	REL8_0_0BETA3:1.28
	REL8_0_0BETA2:1.28
	REL7_2_5:1.12
	REL7_4_5:1.24
	REL7_3_7:1.17
	REL7_4_4:1.24
	REL8_0_0BETA1:1.28
	REL7_4_3:1.24
	REL7_4_2:1.24
	REL7_3_6:1.17
	REL7_4_1:1.24
	REL7_3_5:1.17
	REL7_4:1.24
	REL7_4_RC2:1.24
	REL7_4_STABLE:1.24.0.2
	REL7_4_RC1:1.24
	REL7_4_BETA5:1.23
	REL7_4_BETA4:1.23
	REL7_4_BETA3:1.23
	REL7_4_BETA2:1.22
	WIN32_DEV:1.22.0.2
	REL7_4_BETA1:1.22
	REL7_3_4:1.17
	REL7_3_2:1.17
	REL7_2_4:1.12
	REL7_3_STABLE:1.17.0.2
	REL7_2_3:1.12
	REL7_2_STABLE:1.12.0.2
	REL7_2:1.12
	REL7_2_RC2:1.12
	REL7_2_RC1:1.12
	REL7_2_BETA5:1.12
	REL7_2_BETA4:1.12
	REL7_2_BETA3:1.10
	REL7_2_BETA2:1.9
	REL7_2_BETA1:1.9
	REL7_1_2:1.7
	REL7_1_STABLE:1.7.0.2
	REL7_1_BETA:1.4
	REL7_1_BETA3:1.5
	REL7_1_BETA2:1.5
	REL7_1:1.6;
locks; strict;
comment	@# @;


1.52
date	2010.08.17.04.37.21;	author petere;	state Exp;
branches;
next	1.51;

1.51
date	2010.06.22.16.19.36;	author momjian;	state Exp;
branches
	1.51.2.1;
next	1.50;

1.50
date	2010.04.08.01.39.37;	author rhaas;	state Exp;
branches;
next	1.49;

1.49
date	2010.04.03.07.23.01;	author petere;	state Exp;
branches;
next	1.48;

1.48
date	2010.02.22.22.30.10;	author momjian;	state Exp;
branches;
next	1.47;

1.47
date	2009.12.10.06.32.28;	author petere;	state Exp;
branches;
next	1.46;

1.46
date	2008.06.26.01.12.19;	author momjian;	state Exp;
branches;
next	1.45;

1.45
date	2008.04.23.13.44.58;	author mha;	state Exp;
branches;
next	1.44;

1.44
date	2007.11.10.21.48.51;	author momjian;	state Exp;
branches;
next	1.43;

1.43
date	2007.11.10.14.07.18;	author momjian;	state Exp;
branches;
next	1.42;

1.42
date	2007.11.10.04.52.17;	author momjian;	state Exp;
branches;
next	1.41;

1.41
date	2007.03.26.17.23.36;	author tgl;	state Exp;
branches;
next	1.40;

1.40
date	2007.02.21.23.21.11;	author momjian;	state Exp;
branches;
next	1.39;

1.39
date	2007.02.20.18.10.58;	author momjian;	state Exp;
branches;
next	1.38;

1.38
date	2007.01.31.23.26.04;	author momjian;	state Exp;
branches;
next	1.37;

1.37
date	2007.01.11.02.30.01;	author momjian;	state Exp;
branches;
next	1.36;

1.36
date	2007.01.05.16.17.54;	author adunstan;	state Exp;
branches;
next	1.35;

1.35
date	2006.12.02.00.34.52;	author petere;	state Exp;
branches
	1.35.2.1;
next	1.34;

1.34
date	2006.09.16.00.30.19;	author momjian;	state Exp;
branches;
next	1.33;

1.33
date	2006.06.18.15.38.36;	author petere;	state Exp;
branches;
next	1.32;

1.32
date	2005.11.04.23.14.02;	author petere;	state Exp;
branches;
next	1.31;

1.31
date	2005.02.21.02.13.26;	author neilc;	state Exp;
branches;
next	1.30;

1.30
date	2004.12.22.02.17.15;	author momjian;	state Exp;
branches
	1.30.4.1;
next	1.29;

1.29
date	2004.11.27.21.56.05;	author petere;	state Exp;
branches;
next	1.28;

1.28
date	2004.06.04.04.05.36;	author momjian;	state Exp;
branches;
next	1.27;

1.27
date	2004.05.27.03.50.25;	author momjian;	state Exp;
branches;
next	1.26;

1.26
date	2004.05.14.20.01.19;	author momjian;	state Exp;
branches;
next	1.25;

1.25
date	2003.11.29.19.51.39;	author pgsql;	state Exp;
branches;
next	1.24;

1.24
date	2003.11.01.01.56.29;	author petere;	state Exp;
branches;
next	1.23;

1.23
date	2003.08.31.17.32.23;	author petere;	state Exp;
branches;
next	1.22;

1.22
date	2003.03.25.16.15.42;	author petere;	state Exp;
branches
	1.22.2.1;
next	1.21;

1.21
date	2003.03.24.14.32.51;	author petere;	state Exp;
branches;
next	1.20;

1.20
date	2003.03.20.17.37.46;	author momjian;	state Exp;
branches;
next	1.19;

1.19
date	2003.03.20.05.00.14;	author momjian;	state Exp;
branches;
next	1.18;

1.18
date	2003.01.19.00.13.30;	author momjian;	state Exp;
branches;
next	1.17;

1.17
date	2002.10.11.23.03.48;	author petere;	state Exp;
branches;
next	1.16;

1.16
date	2002.09.21.18.32.54;	author petere;	state Exp;
branches;
next	1.15;

1.15
date	2002.07.28.15.22.20;	author petere;	state Exp;
branches;
next	1.14;

1.14
date	2002.04.21.19.02.39;	author thomas;	state Exp;
branches;
next	1.13;

1.13
date	2002.03.22.19.20.41;	author petere;	state Exp;
branches;
next	1.12;

1.12
date	2001.12.08.03.24.37;	author thomas;	state Exp;
branches;
next	1.11;

1.11
date	2001.11.28.20.49.10;	author petere;	state Exp;
branches;
next	1.10;

1.10
date	2001.11.19.03.58.25;	author tgl;	state Exp;
branches;
next	1.9;

1.9
date	2001.09.21.21.10.56;	author tgl;	state Exp;
branches;
next	1.8;

1.8
date	2001.09.03.12.57.50;	author petere;	state Exp;
branches;
next	1.7;

1.7
date	2001.04.27.01.31.56;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	2001.02.08.19.39.24;	author petere;	state Exp;
branches;
next	1.5;

1.5
date	2000.12.25.23.15.26;	author petere;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.25.17.17.30;	author petere;	state Exp;
branches;
next	1.3;

1.3
date	2000.10.12.22.13.21;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	2000.10.08.13.22.24;	author petere;	state Exp;
branches;
next	1.1;

1.1
date	2000.10.05.19.48.18;	author momjian;	state Exp;
branches;
next	;

1.22.2.1
date	2003.09.07.04.36.45;	author momjian;	state Exp;
branches;
next	;

1.30.4.1
date	2005.02.21.02.14.34;	author neilc;	state Exp;
branches;
next	;

1.35.2.1
date	2007.02.20.18.11.17;	author momjian;	state Exp;
branches;
next	1.35.2.2;

1.35.2.2
date	2007.03.26.17.23.44;	author tgl;	state Exp;
branches;
next	;

1.51.2.1
date	2010.08.17.04.37.19;	author petere;	state Exp;
branches;
next	;


desc
@@


1.52
log
@Spell and markup checking
@
text
@<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.51 2010/06/22 16:19:36 momjian Exp $
PostgreSQL documentation
-->

<refentry id="app-pg-ctl">
 <refmeta>
  <refentrytitle><application>pg_ctl</application></refentrytitle>
  <manvolnum>1</manvolnum>
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>pg_ctl</refname>
  <refpurpose>initialize, start, stop, or restart a <productname>PostgreSQL</productname> server</refpurpose>
 </refnamediv>

 <indexterm zone="app-pg-ctl">
  <primary>pg_ctl</primary>
 </indexterm>

 <refsynopsisdiv>
  <cmdsynopsis>

   <command>pg_ctl</command>
   <arg choice="plain">init[db]</arg>
   <arg>-s</arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <arg>-o <replaceable>options</replaceable></arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">start</arg>
   <arg>-w</arg>
   <arg>-t <replaceable>seconds</replaceable></arg>
   <arg>-s</arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <arg>-l <replaceable>filename</replaceable></arg>
   <arg>-o <replaceable>options</replaceable></arg>
   <arg>-p <replaceable>path</replaceable></arg>
   <arg>-c</arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">stop</arg>
   <arg>-W</arg>
   <arg>-t <replaceable>seconds</replaceable></arg>
   <arg>-s</arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <arg>-m
     <group choice="plain">
       <arg>s[mart]</arg>
       <arg>f[ast]</arg>
       <arg>i[mmediate]</arg>
     </group>
   </arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">restart</arg>
   <arg>-w</arg>
   <arg>-t <replaceable>seconds</replaceable></arg>
   <arg>-s</arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <arg>-c</arg>
   <arg>-m
     <group choice="plain">
       <arg>s[mart]</arg>
       <arg>f[ast]</arg>
       <arg>i[mmediate]</arg>
     </group>
   </arg>
   <arg>-o <replaceable>options</replaceable></arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">reload</arg>
   <arg>-s</arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">status</arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">kill</arg>
   <arg><replaceable>signal_name</replaceable></arg>
   <arg><replaceable>process_id</replaceable></arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">register</arg>
   <arg>-N <replaceable>servicename</replaceable></arg>
   <arg>-U <replaceable>username</replaceable></arg>
   <arg>-P <replaceable>password</replaceable></arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <arg>-w</arg>
   <arg>-t <replaceable>seconds</replaceable></arg>
   <arg>-o <replaceable>options</replaceable></arg>
   <sbr>

   <command>pg_ctl</command>
   <arg choice="plain">unregister</arg>
   <arg>-N <replaceable>servicename</replaceable></arg>

  </cmdsynopsis>
 </refsynopsisdiv>


 <refsect1 id="app-pg-ctl-description">
  <title>Description</title>
  <para>
   <application>pg_ctl</application> is a utility for initializing a
   <productname>PostgreSQL</productname> database cluster, starting,
   stopping, or restarting the <productname>PostgreSQL</productname>
   backend server (<xref linkend="app-postgres">), or displaying the
   status of a running server.  Although the server can be started
   manually, <application>pg_ctl</application> encapsulates tasks such
   as redirecting log output and properly detaching from the terminal
   and process group. It also provides convenient options for
   controlled shutdown.
  </para>

  <para>
   The <option>init</option> or <option>initdb</option> mode creates a
   new
   <productname>PostgreSQL</productname> database cluster.  A database
   cluster is a collection of databases that are managed by a single
   server instance.  This mode invokes the <command>initdb</command>
   command.  See <xref linkend="app-initdb"> for details.
  </para>

  <para>
   In <option>start</option> mode, a new server is launched.  The
   server is started in the background, and standard input is attached
   to <filename>/dev/null</filename> (or <literal>nul</> on Windows).
   On Unix-like systems, by default, the server's standard output and
   standard error are send to <application>pg_ctl</application>'s
   standard output (not standard error).  The standard output of
   <application>pg_ctl</application> should then be redirected to a
   file or piped to another process such as a log rotating program
   like <application>rotatelogs</>; otherwise <command>postgres</command>
   will write its output to the controlling terminal (from the
   background) and will not leave the shell's process group.  On
   Windows, by default the server's standard output and standard error
   are sent to the terminal.  These default  behaviors can be changed
   by using <option>-l</option> to append server output to a log file.
  </para>

  <para>
   In <option>stop</option> mode, the server that is running in
   the specified data directory is shut down.  Three different
   shutdown methods can be selected with the <option>-m</option>
   option: <quote>Smart</quote> mode waits for online backup mode
   to finish and all the clients to disconnect.  This is the default.
   If the server is in recovery, recovery and streaming replication
   will be terminated once all clients have disconnected.
   <quote>Fast</quote> mode does not wait for clients to disconnect and
   will terminate an online backup in progress.  All active transactions are
   rolled back and clients are forcibly disconnected, then the
   server is shut down.  <quote>Immediate</quote> mode will abort
   all server processes without a clean shutdown.  This will lead to 
   a recovery run on restart.
  </para>

  <para>
   <option>restart</option> mode effectively executes a stop followed
   by a start.  This allows changing the <command>postgres</command>
   command-line options.
  </para>

  <para>
   <option>reload</option> mode simply sends the
   <command>postgres</command> process a <systemitem>SIGHUP</>
   signal, causing it to reread its configuration files
   (<filename>postgresql.conf</filename>,
   <filename>pg_hba.conf</filename>, etc.).  This allows changing of
   configuration-file options that do not require a complete restart
   to take effect.
  </para>

  <para>
   <option>status</option> mode checks whether a server is running in
   the specified data directory. If it is, the <acronym>PID</acronym>
   and the command line options that were used to invoke it are
   displayed.
  </para>

  <para>
   <option>kill</option> mode allows you to send a signal to a specified
    process.  This is particularly valuable for <productname>Microsoft Windows</>
    which does not have a <application>kill</> command.  Use 
    <literal>--help</> to see a list of supported signal names.
  </para>

  <para>
   <option>register</option> mode allows you to register a system service
   on <productname>Microsoft Windows</>.
  </para>

  <para>
   <option>unregister</option> mode allows you to unregister a system service
   on <productname>Microsoft Windows</>, previously registered with the
   <option>register</option> command.
  </para>
 </refsect1>

 <refsect1 id="app-pg-ctl-options">
  <title>Options</title>

    <variablelist>

     <varlistentry>
      <term><option>-c</option></term>
      <listitem>
       <para>
        Attempt to allow server crashes to produce core files, on platforms
        where this available, by lifting any soft resource limit placed on 
        them. 
        This is useful in debugging or diagnosing problems by allowing a 
        stack trace to be obtained from a failed server process.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-D <replaceable class="parameter">datadir</replaceable></option></term>
      <listitem>
       <para>
        Specifies the file system location of the database files.  If
        this is omitted, the environment variable
        <envar>PGDATA</envar> is used.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-l <replaceable class="parameter">filename</replaceable></option></term>
      <listitem>
       <para>
        Append the server log output to
        <replaceable>filename</replaceable>.  If the file does not
        exist, it is created.  The <systemitem>umask</> is set to 077, so access to
        the log file from other users is disallowed by default.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-m <replaceable class="parameter">mode</replaceable></option></term>
      <listitem>
       <para>
        Specifies the shutdown mode.  <replaceable>mode</replaceable>
        can be <literal>smart</literal>, <literal>fast</literal>, or
        <literal>immediate</literal>, or the first letter of one of
        these three.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-o <replaceable class="parameter">options</replaceable></option></term>
      <listitem>
       <para>
        Specifies options to be passed directly to the
        <command>postgres</command> command.
       </para>
       <para>
        The options are usually surrounded by single or double
        quotes to ensure that they are passed through as a group.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-p <replaceable class="parameter">path</replaceable></option></term>
      <listitem>
       <para>
        Specifies the location of the <filename>postgres</filename>
        executable.  By default the <filename>postgres</filename> executable is taken from the same
        directory as <command>pg_ctl</command>, or failing that, the hard-wired
        installation directory.  It is not necessary to use this
        option unless you are doing something unusual and get errors
        that the <filename>postgres</filename> executable was not found.
       </para>

       <para>
        In <literal>init</literal> mode, this option analogously
        specifies the location of the <filename>initdb</filename>
        executable.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-s</option></term>
      <listitem>
       <para>
        Only print errors, no informational messages.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-t</option></term>
      <listitem>
       <para>
        The number of seconds to wait when waiting for start or shutdown
        to complete.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-w</option></term>
      <listitem>
       <para>
        Wait for the start or shutdown to complete.  The default wait time
        is 60 seconds.  This is the default option for shutdowns. A successful 
        shutdown is indicated by removal of the <acronym>PID</acronym> 
        file. For starting up, a successful <command>psql -l</command> 
        indicates success. <command>pg_ctl</command> will attempt to 
        use the proper port for <application>psql</>. If the environment variable 
        <envar>PGPORT</envar> exists, that is used. Otherwise, it will see if a port 
        has been set in the <filename>postgresql.conf</filename> file. 
        If neither of those is used, it will use the default port that 
        <productname>PostgreSQL</productname> was compiled with 
        (5432 by default). When waiting, <command>pg_ctl</command> will
        return an accurate exit code based on the success of the startup 
        or shutdown.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-W</option></term>
      <listitem>
       <para>
        Do not wait for start or shutdown to complete.  This is the
        default for starts and restarts.
       </para>
      </listitem>
     </varlistentry>
   </variablelist>

  <refsect2 id="app-pg-ctl-windows-options">
   <title>Options for Windows</title>

   <variablelist>
    <varlistentry>
     <term><option>-N <replaceable class="parameter">servicename</replaceable></option></term>
     <listitem>
      <para>
       Name of the system service to register. The name will be used
       as both the service name and the display name.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-P <replaceable class="parameter">password</replaceable></option></term>
     <listitem>
      <para>
       Password for the user to start the service.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
     <listitem>
      <para>
       User name for the user to start the service. For domain users, use the
       format <literal>DOMAIN\username</literal>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </refsect2>

 </refsect1>


 <refsect1>
  <title>Environment</title>

  <variablelist>
   <varlistentry>
    <term><envar>PGDATA</envar></term>

    <listitem>
     <para>
      Default data directory location.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><envar>PGHOST</envar></term>

    <listitem>
     <para>
      Default host name or Unix-domain socket location for <xref
      linkend="app-psql"> (used by the <option>-w</option> option).
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><envar>PGPORT</envar></term>

    <listitem>
     <para>
      Default port number for <xref linkend="app-psql"> (used by the <option>-w</option> option).
     </para>
    </listitem>
   </varlistentry>

  </variablelist>

  <para>
   For additional server variables, see <xref linkend="app-postgres">.
   This utility, like most other <productname>PostgreSQL</> utilities,
   also uses the environment variables supported by <application>libpq</>
   (see <xref linkend="libpq-envars">).
  </para>
 </refsect1>


 <refsect1>
  <title>Files</title>

  <variablelist>
   <varlistentry>
    <term><filename>postmaster.pid</filename></term>

    <listitem>
     <para>
      The existence of this file in the data directory is used to help
      <application>pg_ctl</application> determine if the server is
      currently running or not.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><filename>postmaster.opts</filename></term>

    <listitem>
     <para>If this file exists in the data directory,
      <application>pg_ctl</application> (in <option>restart</option> mode) 
      will pass the contents of the file as options to
      <application>postgres</application>, unless overridden 
      by the <option>-o</option> option. The contents of this file 
      are also displayed in <option>status</option> mode.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><filename>postgresql.conf</filename></term>

    <listitem>
     <para>
      This file, located in the data directory, is parsed to find the
      proper port to use with <application>psql</application> when the
      <option>-w</option> is given in <option>start</option> mode.
     </para>
    </listitem>
   </varlistentry>

  </variablelist>
 </refsect1>


 <refsect1>
  <title>Notes</title>

  <para>
   Waiting for complete start is not a well-defined operation and might
   fail if access control is set up so that a local client cannot
   connect without manual interaction (e.g., password authentication).  For
   additional connection variables, see <xref linkend="libpq-envars">,
   and for passwords, also see <xref linkend="libpq-pgpass">.
  </para>
 </refsect1>


 <refsect1 id="R1-APP-PGCTL-2">
  <title>Examples</title>

  <refsect2 id="R2-APP-PGCTL-3">
   <title>Starting the Server</title>

   <para>
    To start up a server:
<screen>
<prompt>$</prompt> <userinput>pg_ctl start</userinput>
</screen>
   </para>

   <para>
    An example of starting the server, blocking until the server has
    come up is:
<screen>
<prompt>$</prompt> <userinput>pg_ctl -w start</userinput>
</screen>
   </para>

   <para>
    For a server using port 5433, and
    running without <function>fsync</function>, use:
<screen>
<prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" start</userinput>
</screen>
   </para>
  </refsect2>

  <refsect2 id="R2-APP-PGCTL-4">
   <title>Stopping the Server</title>
   <para>
<screen>
<prompt>$</prompt> <userinput>pg_ctl stop</userinput>
</screen>
    stops the server. Using the <option>-m</option> switch allows one
    to control <emphasis>how</emphasis> the backend shuts down.
   </para>
  </refsect2>

  <refsect2 id="R2-APP-PGCTL-5">
   <title>Restarting the Server</title>

   <para>
    Restarting the server is almost equivalent to stopping the
    server and starting it again
    except that <command>pg_ctl</command> saves and reuses the command line options that
    were passed to the previously running instance.  To restart
    the server in the simplest form, use:
<screen>
<prompt>$</prompt> <userinput>pg_ctl restart</userinput>
</screen>
   </para>

   <para>
    To restart server,
    waiting for it to shut down and to come up:
<screen>
<prompt>$</prompt> <userinput>pg_ctl -w restart</userinput>
</screen>
   </para>

   <para>
    To restart using port 5433 and disabling <function>fsync</> after restarting:
<screen>
<prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" restart</userinput>
</screen>
   </para>
  </refsect2>

  <refsect2 id="R2-APP-PGCTL-6">
   <title>Showing the Server Status</title>

   <para>
    Here is a sample status output from
    <application>pg_ctl</application>:
<screen>
<prompt>$</prompt> <userinput>pg_ctl status</userinput>
<computeroutput>
pg_ctl: server is running (pid: 13718)
Command line was:
/usr/local/pgsql/bin/postgres '-D' '/usr/local/pgsql/data' '-p' '5433' '-B' '128'
</computeroutput>
</screen>
    This is the command line that would be invoked in restart mode.
   </para>
  </refsect2>
 </refsect1>


 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="app-initdb"></member>
   <member><xref linkend="app-postgres"></member>
  </simplelist>
 </refsect1>

</refentry>
@


1.51
log
@Update pg_ctl docs to explain server output behavior differences on
win32 and non-win32 platforms.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.50 2010/04/08 01:39:37 rhaas Exp $
d405 2
a406 2
      Default hostname or Unix-domain socket location for <xref
      linkend="app-psql"> (used by the -w option).
d416 1
a416 1
      Default port number for <xref linkend="app-psql"> (used by the -w option).
@


1.51.2.1
log
@Spell and markup checking
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.51 2010/06/22 16:19:36 momjian Exp $
d405 2
a406 2
      Default host name or Unix-domain socket location for <xref
      linkend="app-psql"> (used by the <option>-w</option> option).
d416 1
a416 1
      Default port number for <xref linkend="app-psql"> (used by the <option>-w</option> option).
@


1.50
log
@Make smart shutdown work in combination with Hot Standby/Streaming Replication.

At present, killing the startup process does not release any locks it holds,
so we must wait to stop the startup and walreceiver processes until all
read-only backends have exited.  Without this patch, the startup and
walreceiver processes never exit, so the server gets permanently stuck in
a half-shutdown state.

Fujii Masao, with review, docs, and comment adjustments by me.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.49 2010/04/03 07:23:01 petere Exp $
d137 13
a149 10
   server is started in the background, and standard input is attached to
   <filename>/dev/null</filename>.  The standard output and standard
   error are either appended to a log file (if the <option>-l</option>
   option is used), or redirected to <application>pg_ctl</application>'s 
   standard output (not standard error).  If no log file is chosen, the 
   standard output of <application>pg_ctl</application> should be redirected 
   to a file or piped to another process such as a log rotating program
   like <application>rotatelogs</>; otherwise <command>postgres</command> 
   will write its output to the controlling terminal (from the background) 
   and will not leave the shell's process group.
@


1.49
log
@Remove unnecessary xref endterm attributes and title ids

The endterm attribute is mainly useful when the toolchain does not support
automatic link target text generation for a particular situation.  In  the
past, this was required by the man page tools for all reference page links,
but that is no longer the case, and it now actually gets in the way of
proper automatic link text generation.  The only remaining use cases are
currently xrefs to refsects.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.48 2010/02/22 22:30:10 momjian Exp $
d155 2
@


1.48
log
@Document that pg_ctl cares about the PGHOST environment variable.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.47 2009/12/10 06:32:28 petere Exp $
d8 1
a8 1
  <refentrytitle id="app-pg-ctl-title"><application>pg_ctl</application></refentrytitle>
@


1.47
log
@Add init[db] option to pg_ctl

pg_ctl gets a new mode that runs initdb.  Adjust the documentation a bit to
not assume that initdb is the only way to run database cluster initialization.
But don't replace initdb as the canonical way.

Author: Zdenek Kotala <Zdenek.Kotala@@Sun.COM>
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.46 2008/06/26 01:12:19 momjian Exp $
d396 11
d411 1
a411 1
      Default port for <xref linkend="app-psql"> (used by the -w option).
d415 1
@


1.46
log
@Remove use of postmaster.opts.default by pg_ctl.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.45 2008/04/23 13:44:58 mha Exp $
d15 1
a15 1
  <refpurpose>start, stop, or restart a <productname>PostgreSQL</productname> server</refpurpose>
d26 7
d115 2
a116 1
   <application>pg_ctl</application> is a utility for starting,
d127 9
d283 6
d568 4
a571 3
  <para>
   <xref linkend="app-postgres">
  </para>
@


1.45
log
@Prevent shutdown in normal mode if online backup is running, and
have pg_ctl warn about this.

Cancel running online backups (by renaming the backup_label file,
thus rendering the backup useless) when shutting down in fast mode.

Laurenz Albe
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.44 2007/11/10 21:48:51 momjian Exp $
a408 14
    <term><filename>postmaster.opts.default</filename></term>

    <listitem>
     <para>
      If this file exists in the data directory,
      <application>pg_ctl</application> (in <option>start</option>
      mode) will pass the contents of the file as options to the
      <command>postgres</command> command, unless overridden by the
      <option>-o</option> option.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
@


1.44
log
@Add pg_ctl -t/timeout parameter to control amount of time to wait for
start/shutdown.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.43 2007/11/10 14:07:18 momjian Exp $
d136 4
a139 3
   option: <quote>Smart</quote> mode waits for all the clients to
   disconnect.  This is the default.  <quote>Fast</quote> mode does
   not wait for clients to disconnect.  All active transactions are
@


1.43
log
@Fix markup problem with recent pg_ctl change.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.42 2007/11/10 04:52:17 momjian Exp $
d24 1
d28 1
d36 1
d40 1
d51 1
d55 1
d68 1
d74 1
d79 1
d85 1
d93 1
d96 1
d100 1
d278 10
d291 2
a292 2
        Wait for the start or shutdown to complete.  Times out after
        60 seconds.  This is the default for shutdowns. A successful 
@


1.42
log
@Properly order pg_ctl -c option alphabetically in docs.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.41 2007/03/26 17:23:36 tgl Exp $
d177 14
a190 12
    <varlistentry>
     <term><option>-c</option></term>
     <listitem>
      <para>
       Attempt to allow server crashes to produce core files, on platforms
       where this available, by lifting any soft resource limit placed on 
       them. 
       This is useful in debugging or diagnosing problems by allowing a 
       stack trace to be obtained from a failed server process.
      </para>
     </listitem>
    </varlistentry>
a191 1
    <variablelist>
@


1.41
log
@Fix seriously broken markup for libpq-envars cross-references.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.40 2007/02/21 23:21:11 momjian Exp $
d177 13
a263 13
      <term><option>-c</option></term>
      <listitem>
       <para>
        Attempt to allow server crashes to produce core files, on platforms
        where this available, by lifting any soft resource limit placed on 
        them. 
        This is useful in debugging or diagnosing problems by allowing a 
        stack trace to be obtained from a failed server process.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
@


1.40
log
@Remove tabs from SGML reference files, so their addition can be detected
in the future.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.39 2007/02/20 18:10:58 momjian Exp $
d361 2
a362 2
   also uses the environment variables supported by <xref 
   linkend="libpq-envars" endterm="libpq">.
@


1.39
log
@More clearly document that most PostgreSQL utilities support libpq
environment variables.  Backpatch to 8.2.X.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.38 2007/01/31 23:26:04 momjian Exp $
d182 3
a184 3
	Specifies the file system location of the database files.  If
	this is omitted, the environment variable
	<envar>PGDATA</envar> is used.
d205 4
a208 4
	Specifies the shutdown mode.  <replaceable>mode</replaceable>
	can be <literal>smart</literal>, <literal>fast</literal>, or
	<literal>immediate</literal>, or the first letter of one of
	these three.
d221 2
a222 2
	The options are usually surrounded by single or double
	quotes to ensure that they are passed through as a group.
d231 6
a236 6
	Specifies the location of the <filename>postgres</filename>
	executable.  By default the <filename>postgres</filename> executable is taken from the same
	directory as <command>pg_ctl</command>, or failing that, the hard-wired
	installation directory.  It is not necessary to use this
	option unless you are doing something unusual and get errors
	that the <filename>postgres</filename> executable was not found.
d256 3
a258 3
		them. 
		This is useful in debugging or diagnosing problems by allowing a 
		stack trace to be obtained from a failed server process.
d267 2
a268 2
	Wait for the start or shutdown to complete.  Times out after
	60 seconds.  This is the default for shutdowns. A successful 
d279 1
a279 1
	or shutdown.
@


1.38
log
@Update reference documentation on may/can/might:

Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.37 2007/01/11 02:30:01 momjian Exp $
d360 3
@


1.37
log
@For pg_ctl -w, add reference to additional environment variables and pgpass.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.36 2007/01/05 16:17:54 adunstan Exp $
d206 1
a206 1
	may be <literal>smart</literal>, <literal>fast</literal>, or
d428 1
a428 1
   Waiting for complete start is not a well-defined operation and may
@


1.36
log
@
Call setrlimit if possible in pg_regress to allow core file generation, and provide a switch for similar behaviour in pg_ctl.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.35 2006/12/02 00:34:52 petere Exp $
d359 1
a359 1
   For others, see <xref linkend="app-postgres">.
d430 3
a432 1
   connect without manual interaction (e.g., password authentication).
@


1.35
log
@Make Options for Windows a second-level heading instead of first-level.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.34 2006/09/16 00:30:19 momjian Exp $
d32 1
d52 1
d251 13
@


1.35.2.1
log
@More clearly document that most PostgreSQL utilities support libpq
environment variables.  Backpatch to 8.2.X.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.35 2006/12/02 00:34:52 petere Exp $
d344 1
a344 4
   For additional server variables, see <xref linkend="app-postgres">.
   This utility, like most other <productname>PostgreSQL</> utilities,
   also uses the environment variables supported by <xref 
   linkend="libpq-envars" endterm="libpq">.
@


1.35.2.2
log
@Fix seriously broken markup for libpq-envars cross-references.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.35.2.1 2007/02/20 18:11:17 momjian Exp $
d346 2
a347 2
   also uses the environment variables supported by <application>libpq</>
   (see <xref linkend="libpq-envars">).
@


1.34
log
@Remove emacs info from footer of SGML files.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.33 2006/06/18 15:38:36 petere Exp $
a174 2
  <para>

a278 2
  </para>
 </refsect1>
d280 3
a282 3
 <refsect1 id="app-pg-ctl-svcoptions">
  <title>Windows options</title>
  <para>
d313 2
a314 1
  </para>
@


1.33
log
@Merge postmaster and postgres command into just postgres.  postmaster
symlink is kept for now for compatibility.  To call single-user mode, use
postgres --single.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.32 2005/11/04 23:14:02 petere Exp $
a522 17

<!-- 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.32
log
@Spellchecking run, final cleanups
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.31 2005/02/21 02:13:26 neilc Exp $
d95 1
a95 1
   backend server (<xref linkend="app-postmaster">), or displaying the
d112 1
a112 1
   like <application>rotatelogs</>; otherwise the <command>postmaster</command> 
d132 1
a132 1
   by a start.  This allows changing the <command>postmaster</command>
d138 1
a138 1
   <command>postmaster</command> process a <systemitem>SIGHUP</>
d218 1
a218 1
        <command>postmaster</command> command.
d231 2
a232 2
	Specifies the location of the <filename>postmaster</filename>
	executable.  By default the <filename>postmaster</filename> executable is taken from the same
d236 1
a236 1
	that the <filename>postmaster</filename> executable was not found.
d347 1
a347 1
   For others, see <xref linkend="app-postmaster">.
d376 1
a376 1
      <command>postmaster</command> command, unless overridden by the
d388 2
a389 2
      will pass the contents of the file as options to the 
      <application>postmaster</application>, unless overridden 
d503 1
a503 1
pg_ctl: postmaster is running (pid: 13718)
d505 1
a505 1
/usr/local/pgsql/bin/postmaster '-D' '/usr/local/pgsql/data' '-p' '5433' '-B' '128'
d518 1
a518 1
   <xref linkend="app-postmaster">
@


1.31
log
@Document the "register" and "unregister" pg_ctl subcommands, for use on
Windows. Patch from Magnus Hagander.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.30 2004/12/22 02:17:15 momjian Exp $
d311 1
a311 1
       Username for the user to start the service. For domain users, use the
@


1.30
log
@Add mention that pg_ctl will return an accurate exit code when waiting
for startup or shutdown.  We have always done this but it wasn't documented.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.29 2004/11/27 21:56:05 petere Exp $
d73 13
d159 11
d280 38
a317 2
    </variablelist>
   </para>
@


1.30.4.1
log
@Document the "register" and "unregister" pg_ctl subcommands, for use on
Windows. Patch from Magnus Hagander.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.30 2004/12/22 02:17:15 momjian Exp $
a72 13
   <sbr>
   <command>pg_ctl</command>
   <arg choice="plain">register</arg>
   <arg>-N <replaceable>servicename</replaceable></arg>
   <arg>-U <replaceable>username</replaceable></arg>
   <arg>-P <replaceable>password</replaceable></arg>
   <arg>-D <replaceable>datadir</replaceable></arg>
   <arg>-w</arg>
   <arg>-o <replaceable>options</replaceable></arg>
   <sbr>
   <command>pg_ctl</command>
   <arg choice="plain">unregister</arg>
   <arg>-N <replaceable>servicename</replaceable></arg>
a145 11

  <para>
   <option>register</option> mode allows you to register a system service
   on <productname>Microsoft Windows</>.
  </para>

  <para>
   <option>unregister</option> mode allows you to unregister a system service
   on <productname>Microsoft Windows</>, previously registered with the
   <option>register</option> command.
  </para>
d256 2
a257 38
   </variablelist>
  </para>
 </refsect1>

 <refsect1 id="app-pg-ctl-svcoptions">
  <title>Windows options</title>
  <para>
   <variablelist>
    <varlistentry>
     <term><option>-N <replaceable class="parameter">servicename</replaceable></option></term>
     <listitem>
      <para>
       Name of the system service to register. The name will be used
       as both the service name and the display name.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-P <replaceable class="parameter">password</replaceable></option></term>
     <listitem>
      <para>
       Password for the user to start the service.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
     <listitem>
      <para>
       Username for the user to start the service. For domain users, use the
       format <literal>DOMAIN\username</literal>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
@


1.29
log
@Correctly name the Windows operating systems
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.28 2004/06/04 04:05:36 momjian Exp $
d240 3
a242 1
        (5432 by default).
@


1.28
log
@Remove dash in pg_ctl signal name.  It broke with getopt_long dash
reorganization processing, and it is clearer without the dash anyway.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.27 2004/05/27 03:50:25 momjian Exp $
d142 1
a142 1
    process.  This is particularly valuable for <productname>MS Windows</>
@


1.27
log
@Document new pg_ctl 'kill' command, specificially for Win32.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.26 2004/05/14 20:01:19 momjian Exp $
d143 2
a144 1
    which does not have a <application>kill</> command.
@


1.26
log
@Properly document rotatelogs, and add mention of it to pg_ctl manual page.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.25 2003/11/29 19:51:39 pgsql Exp $
d68 5
d138 6
@


1.25
log
@
$Header: -> $PostgreSQL Changes ...
@
text
@d2 1
a2 1
$PostgreSQL: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.24 2003/11/01 01:56:29 petere Exp $
d90 1
a90 1
   option is used), or redirected to  <application>pg_ctl</application>'s 
d93 4
a96 4
   to a file or piped to another process, for example a log rotating program,
   otherwise <command>postmaster</command> will write its output to the controlling
   terminal (from the background) and will not leave the shell's
   process group.
@


1.24
log
@Spell checking, consistent terminology.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.23 2003/08/31 17:32:23 petere Exp $
@


1.23
log
@Add/edit index entries.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.22 2003/03/25 16:15:42 petere Exp $
d223 2
a224 2
        use the proper port for psql. If the environment variable 
        PGPORT exists, that is used. Otherwise, it will see if a port 
@


1.22
log
@Merge documentation into one book.  (Build with "make html".)  Replace
vague cross-references with real links.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.21 2003/03/24 14:32:51 petere Exp $
d17 4
@


1.22.2.1
log
@Update this branch to match CVS head, includes WIN32 improvements.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.23 2003/08/31 17:32:23 petere Exp $
a16 4

 <indexterm zone="app-pg-ctl">
  <primary>pg_ctl</primary>
 </indexterm>
@


1.21
log
@Another big editing pass for consistent content and presentation.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.20 2003/03/20 17:37:46 momjian Exp $
d440 1
a440 1
   <xref linkend="app-postmaster">, &cite-admin;
@


1.20
log
@Fix typo in SGML tags.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.19 2003/03/20 05:00:14 momjian Exp $
d72 6
a77 6
   stopping, or restarting <xref linkend="app-postmaster">, the
   <productname>PostgreSQL</productname> backend server, or displaying
   the status of a running postmaster.  Although the postmaster can be
   started manually, <application>pg_ctl</application> encapsulates
   tasks such as redirecting log output and properly detaching from the
   terminal and process group. It also provides convenient options for
d82 1
a82 1
   In <option>start</option> mode, a new postmaster is launched.  The
d90 1
a90 1
   otherwise the postmaster will write its output to the controlling
d96 1
a96 1
   In <option>stop</option> mode, the postmaster that is running in
d103 1
a103 1
   database is shut down.  <quote>Immediate</quote> mode will abort
d110 2
a111 2
   by a start.  This allows the changing of postmaster command line
   options.
d115 7
a121 5
   <option>reload</option> mode simply sends the postmaster a <systemitem>SIGHUP</> signal,
   causing it to reread its configuration files
   (<filename>postgresql.conf</filename>, <filename>pg_hba.conf</filename>,
   etc.).  This allows changing of configuration-file options that do not
   require a complete restart to take effect.
d125 4
a128 3
   <option>status</option> mode checks whether a postmaster is running. 
   If it is, the <acronym>PID</acronym> and the command line
   options that were used to invoke it are displayed.
d139 1
a139 1
      <term>-D <replaceable class="parameter">datadir</replaceable></term>
d150 1
a150 1
      <term>-l <replaceable class="parameter">filename</replaceable></term>
d162 1
a162 1
      <term>-m <replaceable class="parameter">mode</replaceable></term>
d174 1
a174 1
      <term>-o <replaceable class="parameter">options</replaceable></term>
d177 2
a178 2
        Specifies options to be passed directly to
	<application>postmaster</application>.
d181 1
a181 1
	The parameters are usually surrounded by single or double
d188 1
a188 1
      <term>-p <replaceable class="parameter">path</replaceable></term>
d192 1
a192 1
	executable.  By default the postmaster is taken from the same
d196 1
a196 1
	that the postmaster was not found.
d202 1
a202 1
      <term>-s</term>
d211 1
a211 1
      <term>-w</term>
d230 1
a230 1
      <term>-W</term>
d282 4
a285 3
     <para>The existence of this file in the data directory is used to help 
           <application>pg_ctl</application> determine if the server is 
           currently running or not.
d294 6
a299 5
     <para>If this file exists in the data directory, 
      <application>pg_ctl</application> (in <option>start</option> mode) 
      will pass the contents of the file as options to the 
      <application>postmaster</application>, unless overridden 
      by the <option>-o</option> option.
d322 4
a325 4
     <para>This file, located in the data directory, is parsed to 
      find the proper port to send to the 
      <application>psql</application> when the <option>-w</option> 
      is given in <option>start</option> mode.      
d340 1
a340 1
   connect without manual interaction (e.g. password authentication).
d349 1
a349 1
   <title>Starting the postmaster</title>
d352 1
a352 1
    To start up a <application>postmaster</application>:
d359 2
a360 2
    An example of starting the <application>postmaster</application>,
    blocking until the postmaster comes up is:
d367 1
a367 1
    For a <application>postmaster</application> using port 5433, and
d376 1
a376 1
   <title>Stopping the postmaster</title>
d381 1
a381 1
    stops the postmaster. Using the <option>-m</option> switch allows one
d387 1
a387 1
   <title>Restarting the postmaster</title>
d390 2
a391 2
    This is almost equivalent to stopping the
    <application>postmaster</application> and starting it again
d394 1
a394 1
    the <application>postmaster</application> in the simplest form:
d401 1
a401 1
    To restart <application>postmaster</application>,
d417 1
a417 1
   <title>Showing postmaster status</title>
@


1.19
log
@(Now featuring documentation: fixed some typos, expanded the
Envrironment and Files section, explained exactly what -w
does)

This is a patch which allows pg_ctl to make an intelligent
guess as to the proper port when running 'psql -l' to
determine if the database has started up (the -w flag).

The environment variable PGPORT is used. If that is not found,
it checks if a specific port has been set inside the postgresql.conf
file. If it is has not, it uses the port that Postgres was
compiled with.

Greg Sabino Mullane  greg@@turnstep.com
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.18 2003/01/19 00:13:30 momjian Exp $
d213 1
a213 1
        shutdown is indicated by removal of the <acronym>PID</scronym> 
@


1.18
log
@This patch includes a lot of minor cleanups to the SGML documentation,
including:

- replacing all the appropriate usages of <citetitle>PostgreSQL
...</citetitle> with &cite-user;, &cite-admin;, and so on

- fix an omission in the EXECUTE documentation

- add some more text to the EXPLAIN documentation

- improve the PL/PgSQL RETURN NEXT documentation (more work to do here)

- minor markup fixes


Neil Conway
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.17 2002/10/11 23:03:48 petere Exp $
d76 2
a77 2
   tasks such as redirecting log output, properly detaching from the
   terminal and process group, and it provides convenient options for
d83 1
a83 1
   server is started in the background, the standard input attached to
d85 6
a90 7
   error are either appended to a log file, if the <option>-l</option>
   option is used, or are redirected to
   <application>pg_ctl</application>'s standard output (not standard
   error).  If no log file is chosen, the standard output of
   <application>pg_ctl</application> should be redirected to a file or
   piped to another process, for example a log rotating program,
   otherwise the postmaster will write its output the the controlling
d104 2
a105 2
   all server processes without clean shutdown.  This will lead to a recovery
   run on restart.
d123 3
a125 3
   <option>status</option> mode checks whether a postmaster is running
   and if so displays the <acronym>PID</acronym> and the command line
   options that were used to invoke it.
d190 1
a190 1
	directory as <command>pg_ctl</>, or failing that, the hard-wired
d212 10
a221 1
	60 seconds.  This is the default for shutdowns.
d249 11
a259 1
      Default data direction location
d274 52
a325 6
   <para>
    If the file <filename>postmaster.opts.default</filename> exists in
    the data directory, the contents of the file will be passed as
    options to the <application>postmaster</application>, unless
    overridden by the <option>-o</option> option.
   </para>
d335 1
a335 1
   connect without manual interaction.  It should be avoided.
@


1.17
log
@Assorted reference page updates
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.16 2002/09/21 18:32:54 petere Exp $
d371 1
a371 1
   <xref linkend="app-postmaster">, <citetitle>PostgreSQL Administrator's Guide</citetitle>
@


1.16
log
@Add more appropriate markup.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.15 2002/07/28 15:22:20 petere Exp $
d128 1
d130 4
a133 3
  <refsect2 id="app-pg-ctl-options">
   <title>Options</title>
   <para>
a228 1
  </refsect2>
@


1.15
log
@Structure reference pages consistently.  Document that structure.
Add information about environment variables.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.14 2002/04/21 19:02:39 thomas Exp $
d151 1
a151 1
        exist, it is created.  The umask is set to 077, so access to
@


1.14
log
@Augment the date/time examples in the User's Guide to reflect the newer
 capabilities of specifying time zones as intervals per SQL9x.
Put refentrytitle contents on the same line as the tag.
 Otherwise, leading whitespace is propagated into the product, which
 (at least) messes up the ToC layout.
Remove (some) docinfo tags containing dates. Best to omit if the dates
 are not accurate; maybe use CVS dates instead or leave them out.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.13 2002/03/22 19:20:41 petere Exp $
d228 5
d234 20
a253 2
  <refsect2>
   <title>Files</title>
d261 5
a265 1
  </refsect2>
d267 5
a364 9
 <refsect1>
  <title>Bugs</title>

  <para>
   Waiting for complete start is not a well-defined operation and may
   fail if access control is set up so that a local client cannot
   connect without manual interaction.  It should be avoided.
  </para>
 </refsect1>
@


1.13
log
@Spell checking and markup additions
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.12 2001/12/08 03:24:37 thomas Exp $
a6 4
 <docinfo>
  <date>2001-02-08</date>
 </docinfo>

@


1.12
log
@Use PostgreSQL consistantly throughout docs. Before, usage was split evenly
 between Postgres and PostgreSQL.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.11 2001/11/28 20:49:10 petere Exp $
d79 1
a79 1
   started manually, <application>pg_ctl</application> encapulates
d193 1
a193 1
	directory as pg_ctl, or failing that, the hard-wired
d294 1
a294 1
    except that pg_ctl saves and reuses the command line options that
d311 1
a311 1
    To restart using port 5433 and disabling fsync after restarting:
@


1.11
log
@proof-reading
@
text
@d2 2
a3 2
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.10 2001/11/19 03:58:25 tgl Exp $
Postgres documentation
@


1.10
log
@A bunch of small doco updates motivated by scanning the comments on
the interactive docs.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.9 2001/09/21 21:10:56 tgl Exp $
d82 1
a82 1
   controlled shut down.
d120 1
a120 1
   <option>reload</option> mode simply sends the postmaster a SIGHUP signal,
d123 1
a123 1
   etc).  This allows changing of configuration-file options that do not
d202 1
a202 1
      <term>-w</term>
d205 1
a205 2
	Wait for the start or shutdown to complete.  Times out after
	60 seconds.  This is the default for shutdowns.
d211 1
a211 1
      <term>-W</term>
d214 2
a215 2
        Do not wait for start or shutdown to complete.  This is the
        default for starts and restarts.
d221 1
a221 1
      <term>-s</term>
d224 2
a225 1
        Only print errors, no informational messages.
d254 1
a254 1
    To start up <application>postmaster</application>:
d262 1
a262 1
    blocking until postmaster comes up is:
d283 1
a283 1
    stops postmaster. Using the <option>-m</option> switch allows one
d293 1
a293 1
    <application>postmaster</application> then starting it again
d296 1
a296 1
    <application>postmaster</application> in the simplest form:
@


1.9
log
@Add 'reload' option to pg_ctl to send SIGHUP to the postmaster.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.8 2001/09/03 12:57:50 petere Exp $
d106 5
a110 3
   not wait for clients to disconnect.  All active transactions will
   be rolled back.  <quote>Immediate</quote> mode will abort without
   complete shutdown.  This will lead to a recovery run on restart.
d342 1
a342 1
   fail if access control is set up in way that a local client cannot
@


1.8
log
@Put some kind of grammatical uniformity in the <refpurpose> lines.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.7 2001/04/27 01:31:56 momjian Exp $
d61 5
d81 1
a81 1
   terminal and process group, and additionally provides an option for
d101 1
a101 1
   In <option>stop</option> mode, the postmaster that is running on
a108 1
   By the default, stop mode waits for the shutdown to complete.
d118 8
d203 1
a203 1
	Wait for the start or stutdown to complete.  Times out after
@


1.7
log
@A small patch for a small option (for rel. 7.1).

Jimmy Olgeni
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.6 2001/02/08 19:39:24 petere Exp $
d19 1
a19 1
  <refpurpose>Starts, stops, or restarts postmaster</refpurpose>
@


1.6
log
@Make -w the default for shut down, add -W option to specify no wait.
Add -l option to name log file.  Set umask to 077.
Proper file descriptor redirection to allow postmaster to detach from
shell's process group.
Add -s option to turn off informational messages.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.5 2000/12/25 23:15:26 petere Exp $
d27 1
d36 1
d49 1
d203 9
@


1.5
log
@Refine some things to create better looking man pages.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.4 2000/11/25 17:17:30 petere Exp $
d8 1
a8 1
  <date>2000-11-25</date>
d28 2
a30 1
   <arg>-o <replaceable>options</replaceable></arg>
d34 1
a34 1
   <arg>-w</arg>
d68 46
a113 2
   stopping, or restarting the <xref linkend="app-postmaster">, or
   displaying the status of a running postmaster.
d122 1
a122 1
      <term>-w</term>
d125 3
a127 4
	Wait for the database server to come up, by watching for
	creation of the pid file
	(<filename><replaceable>PGDATA</replaceable>/postmaster.pid</filename>).
	Times out after 60 seconds.
d133 1
a133 1
      <term>-D <replaceable class="parameter">datadir</replaceable></term>
d136 4
a139 3
	Specifies the file system location of the database files.  If
	this is omitted, the environment variable
	<envar>PGDATA</envar> is used.
d145 1
a145 1
      <term>-p <replaceable class="parameter">path</replaceable></term>
d148 4
a151 6
	Specifies the location of the <filename>postmaster</filename>
	executable.  By default the postmaster is taken from the same
	directory as pg_ctl, or failing that, the hard-wired
	installation directory.  It is not necessary to use this
	option unless you are doing something unusual and get errors
	that the postmaster was not found.
d171 1
a171 1
      <term>-m <replaceable class="parameter">mode</replaceable></term>
d174 6
a179 36
	Specifies the shutdown mode.

	<variablelist>
	 <varlistentry>
	  <term>smart</term>
	  <term>s</term>
	  <listitem>
	   <para>
	    Smart mode waits for all the clients to disconnect. This
	    is the default.
	   </para>
	  </listitem>
	 </varlistentry>

	 <varlistentry>
	  <term>fast</term>
	  <term>f</term>
	  <listitem>
	   <para>
	    Fast mode does not wait for clients to disconnect.  All
	    active transactions will be rolled back.
	   </para>
	  </listitem>
	 </varlistentry>

	 <varlistentry>
	  <term>immediate</term>
	  <term>i</term>
	  <listitem>
	   <para>
	    Immediate mode will abort without complete shutdown.  This
	    will lead to a recovery run on restart.
	   </para>
	  </listitem>
	 </varlistentry>
	</variablelist>
d185 1
a185 1
      <term>start</term>
d188 2
a189 1
	Start up <application>postmaster</application>.
d195 1
a195 1
      <term>stop</term>
d198 2
a199 20
	Shut down <application>postmaster</application>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>restart</term>
      <listitem>
       <para>
	Stop the <application>postmaster</application>, if one is running,
	and then start it again.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term>status</term>
      <listitem>
       <para>
	Show the current state of <application>postmaster</application>.
d222 1
a222 1
  <title>Usage</title>
a258 1
    <option>-w</option> waits for postmaster to shut down.
d310 19
@


1.4
log
@Update pg_ctl ref page, help output, messages.  Some repair to work better
with current postmaster.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.3 2000/10/12 22:13:21 momjian Exp $
d67 2
a68 3
   stopping, or restarting the <xref linkend="app-postmaster"
   endterm="app-postmaster-title">, or displaying the status of a
   running postmaster.
@


1.3
log
@Fix typo
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.2 2000/10/08 13:22:24 petere Exp $
d7 4
d12 2
a13 3
  <refentrytitle id="app-pg-ctl-title">
   <application>pg_ctl</application>
  </refentrytitle>
d18 2
a19 6
  <refname>
   <application>pg_ctl</application>
  </refname>
  <refpurpose>
   Starts, stops, and restarts postmaster
  </refpurpose>
d23 51
a73 16
  <refsynopsisdivinfo>
   <date>2000-04-05</date>
  </refsynopsisdivinfo>

  <synopsis>
pg_ctl [-w] [-D <replaceable class="parameter">datadir</replaceable>][-p <replaceable class="parameter">path</replaceable>] [-o "<replaceable class="parameter">options</replaceable>"] start
pg_ctl [-w] [-D <replaceable class="parameter">datadir</replaceable>] [-m [s[mart]|f[ast]|i[mmediate]]] stop
pg_ctl [-w] [-D <replaceable class="parameter">datadir</replaceable>] [-m [s[mart]|f[ast]|i[mmediate]]
    [-o "<replaceable class="parameter">options</replaceable>"] restart
pg_ctl [-D <replaceable class="parameter">datadir</replaceable>] status
  </synopsis>

  <refsect2 id="R2-APP-PGCTL-1">
   <title>
    Inputs
   </title>
d81 3
a83 2
	Wait for the database server to come up, by
	watching for creation of the pid file (PGDATA/postmaster.pid).
d93 3
a95 1
	Specifies the database location for this database installation.
d104 6
a109 1
	Specifies the path to the postmaster image.
d115 1
a115 1
      <term>-o "<replaceable class="parameter">options</replaceable>"</term>
d140 2
a141 2
	    smart mode waits for all
	    the clients to logout. This is the default.
d151 2
a152 2
	    Fast mode sends SIGTERM to the backends; that means
	    active transactions get rolled back.
d162 2
a163 3
	    Immediate mode sends SIGUSR1
	    to the backends and lets them abort. In this case, database recovery
	    will be necessary on the next start-up.
d194 2
a195 2
	Restart the <application>postmaster</application>, performing
	a stop/start sequence.
d212 3
a214 7
  <refsect2 id="R2-APP-PGCTL-2">
   <refsect2info>
    <date>1999-11-07</date>
   </refsect2info>
   <title>
    Outputs
   </title>
d216 4
a219 12
    <variablelist>
     <varlistentry>
      <term><computeroutput>pg_ctl: postmaster is <replaceable>state</replaceable> (pid: <replaceable>#</replaceable>)</computeroutput></term>
      <listitem>
       <para>
	Postmaster status.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>

    If there is an error condition, the backend error message will be displayed.
a221 1
 </refsynopsisdiv>
a222 8
 <refsect1 id="R1-APP-PGCTL-1">
  <title>
   Description
  </title>
  <para>
   <application>pg_ctl</application> is a utility for starting,
   stopping or restarting <application>postmaster</application>.
  </para>
d225 1
d227 1
a227 3
  <title>
   Usage
  </title>
d230 1
a230 3
   <title>
    Starting postmaster
   </title>
d234 3
a236 52

    <programlisting>
$ pg_ctl start
    </programlisting>
   </para>

   <para>
    If -w is supplied, pg_ctl waits for the database server to come up, by
    watching for creation of the pid file (PGDATA/postmaster.pid), for up
    to 60 seconds.
   </para>

   <para>
    Parameters to invoke <application>postmaster</application> are
    taken from the following sources:

    <itemizedlist>
     <listitem>
      <para>
       Path to postmaster: found in the command search path.
      </para>
     </listitem>

     <listitem>
      <para>
       Database directory: <envar>PGDATA</envar> environment variable.
      </para>
     </listitem>

     <listitem>
      <para>
       Other parameters:
       <filename><envar>PGDATA</envar>/postmaster.opts.default</filename>.
      </para>
     </listitem>
    </itemizedlist>
   </para>

   <para>
    <filename>postmaster.opts.default</filename> contains parameters
    for <application>postmaster</application>.
   </para>

   <para>
    Note that <filename>postmaster.opts.default</filename> is
    installed by <application>initdb</application> from
    <filename>lib/postmaster.opts.default.sample</filename>
    under the <productname>Postgres</productname> installation
    directory (<filename>lib/postmaster.opts.default.sample</filename>
    is copied from
    <filename>src/bin/pg_ctl/postmaster.opts.default.sample</filename>
    while installing <productname>Postgres</productname>).
d240 5
a244 20
    To override the default parameters you can use <option>-D</option>,
    <option>-p</option> and <option>-o</option> options.
   </para>

   <para>
    An example of starting the
    <application>postmaster</application>, blocking until
    postmaster comes up is:
    <programlisting>
$ pg_ctl -w start
    </programlisting>
   </para>

   <para>
    To specify the <application>postmaster</application> binary path,
    try:

    <programlisting>
$ pg_ctl -p /usr/local/pgsql/bin/postmaster start
    </programlisting>
d250 3
a252 4

    <programlisting>
$ pg_ctl -o "-o -F -p 5433" start
    </programlisting>
d257 1
a257 3
   <title>
    Stopping postmaster
   </title>
d259 3
a261 5

    <programlisting>
$ pg_ctl stop
    </programlisting>

d264 1
a264 3
    <option>-w</option>
    waits for postmaster to shut down.
    <option>-m</option> specifies the shut down mode.
d269 1
a269 3
   <title>
    Restarting postmaster
   </title>
d273 7
a279 18
    <application>postmaster</application> then starting it
    again except that the parameters used before stopping
    it would be used too. This is done by saving them in
    $<envar>PGDATA</envar>/postmaster.opts file.
    <option>-w</option>, <option>-D</option>, <option>-m</option>,
    <option>-fast</option>, <option>-immediate</option> and
    <option>-o</option> 
    can also be used in the restarting mode and they have the same meanings as
    described above.
   </para>

   <para>
    To restart <application>postmaster</application> in the simplest
    form:

    <programlisting>
$ pg_ctl restart
    </programlisting>
d285 3
a287 4

    <programlisting>
$ pg_ctl -w restart
    </programlisting>
d292 3
a294 4

    <programlisting>
$ pg_ctl -o "-o -F -p 5433" restart
    </programlisting>
d299 1
a299 3
   <title>
    postmaster status
   </title>
d302 5
a306 11
    To get status information from postmaster:

    <programlisting>
$ pg_ctl status
    </programlisting>
   </para>

   <para>
    Here is a sample output from <application>pg_ctl</application>:

    <programlisting>
d308 5
a312 9
options are:
/usr/local/src/pgsql/current/bin/postmaster
-p 5433
-D /usr/local/src/pgsql/current/data
-B 64
-b /usr/local/src/pgsql/current/bin/postgres
-N 32
-o '-F'
    </programlisting>
@


1.2
log
@markup repair
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.1 2000/10/05 19:48:18 momjian Exp $
d290 1
a290 1
$ pg_ctl -p /usr/local/pgsq/bin/postmaster start
@


1.1
log
@Add proofreader's changes to docs.
Fix misspelling of disbursion to dispersion.
@
text
@d2 1
a2 1
$Header: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.7 2000/08/29 20:02:09 momjian Exp $
d6 1
a6 1
<refentry id="app-pg_ctl">
d8 1
a8 1
  <refentrytitle id="app-pg_ctl-title">
@
