1<!--
2doc/src/sgml/ref/pg_ctl-ref.sgml
3PostgreSQL documentation
4-->
5
6<refentry id="app-pg-ctl">
7 <indexterm zone="app-pg-ctl">
8  <primary>pg_ctl</primary>
9 </indexterm>
10
11 <refmeta>
12  <refentrytitle><application>pg_ctl</application></refentrytitle>
13  <manvolnum>1</manvolnum>
14  <refmiscinfo>Application</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18  <refname>pg_ctl</refname>
19  <refpurpose>initialize, start, stop, or control a <productname>PostgreSQL</productname> server</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23  <cmdsynopsis>
24   <command>pg_ctl</command>
25   <arg choice="plain"><option>init[db]</option></arg>
26   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
27   <arg choice="opt"><option>-s</option></arg>
28   <arg choice="opt"><option>-o</option> <replaceable>initdb-options</replaceable></arg>
29  </cmdsynopsis>
30
31  <cmdsynopsis>
32   <command>pg_ctl</command>
33   <arg choice="plain"><option>start</option></arg>
34   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
35   <arg choice="opt"><option>-l</option> <replaceable>filename</replaceable></arg>
36   <arg choice="opt"><option>-W</option></arg>
37   <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg>
38   <arg choice="opt"><option>-s</option></arg>
39   <arg choice="opt"><option>-o</option> <replaceable>options</replaceable></arg>
40   <arg choice="opt"><option>-p</option> <replaceable>path</replaceable></arg>
41   <arg choice="opt"><option>-c</option></arg>
42  </cmdsynopsis>
43
44  <cmdsynopsis>
45   <command>pg_ctl</command>
46   <arg choice="plain"><option>stop</option></arg>
47   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
48   <arg choice="opt"><option>-m</option>
49     <group choice="plain">
50       <arg choice="plain"><option>s[mart]</option></arg>
51       <arg choice="plain"><option>f[ast]</option></arg>
52       <arg choice="plain"><option>i[mmediate]</option></arg>
53     </group>
54   </arg>
55   <arg choice="opt"><option>-W</option></arg>
56   <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg>
57   <arg choice="opt"><option>-s</option></arg>
58  </cmdsynopsis>
59
60  <cmdsynopsis>
61   <command>pg_ctl</command>
62   <arg choice="plain"><option>restart</option></arg>
63   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
64   <arg choice="opt"><option>-m</option>
65     <group choice="plain">
66       <arg choice="plain"><option>s[mart]</option></arg>
67       <arg choice="plain"><option>f[ast]</option></arg>
68       <arg choice="plain"><option>i[mmediate]</option></arg>
69     </group>
70   </arg>
71   <arg choice="opt"><option>-W</option></arg>
72   <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg>
73   <arg choice="opt"><option>-s</option></arg>
74   <arg choice="opt"><option>-o</option> <replaceable>options</replaceable></arg>
75   <arg choice="opt"><option>-c</option></arg>
76  </cmdsynopsis>
77
78  <cmdsynopsis>
79   <command>pg_ctl</command>
80   <arg choice="plain"><option>reload</option></arg>
81   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
82   <arg choice="opt"><option>-s</option></arg>
83  </cmdsynopsis>
84
85  <cmdsynopsis>
86   <command>pg_ctl</command>
87   <arg choice="plain"><option>status</option></arg>
88   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
89  </cmdsynopsis>
90
91  <cmdsynopsis>
92   <command>pg_ctl</command>
93   <arg choice="plain"><option>promote</option></arg>
94   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
95   <arg choice="opt"><option>-W</option></arg>
96   <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg>
97   <arg choice="opt"><option>-s</option></arg>
98  </cmdsynopsis>
99
100  <cmdsynopsis>
101   <command>pg_ctl</command>
102   <arg choice="plain"><option>logrotate</option></arg>
103   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
104   <arg choice="opt"><option>-s</option></arg>
105  </cmdsynopsis>
106
107  <cmdsynopsis>
108   <command>pg_ctl</command>
109   <arg choice="plain"><option>kill</option></arg>
110   <arg choice="plain"><replaceable>signal_name</replaceable></arg>
111   <arg choice="plain"><replaceable>process_id</replaceable></arg>
112  </cmdsynopsis>
113
114  <para>On Microsoft Windows, also:</para>
115
116  <cmdsynopsis>
117   <command>pg_ctl</command>
118   <arg choice="plain"><option>register</option></arg>
119   <arg choice="opt"><option>-D</option> <replaceable>datadir</replaceable></arg>
120   <arg choice="opt"><option>-N</option> <replaceable>servicename</replaceable></arg>
121   <arg choice="opt"><option>-U</option> <replaceable>username</replaceable></arg>
122   <arg choice="opt"><option>-P</option> <replaceable>password</replaceable></arg>
123   <arg choice="opt"><option>-S</option>
124     <group choice="plain">
125       <arg choice="plain"><option>a[uto]</option></arg>
126       <arg choice="plain"><option>d[emand]</option></arg>
127     </group>
128   </arg>
129   <arg choice="opt"><option>-e</option> <replaceable>source</replaceable></arg>
130   <arg choice="opt"><option>-W</option></arg>
131   <arg choice="opt"><option>-t</option> <replaceable>seconds</replaceable></arg>
132   <arg choice="opt"><option>-s</option></arg>
133   <arg choice="opt"><option>-o</option> <replaceable>options</replaceable></arg>
134  </cmdsynopsis>
135
136  <cmdsynopsis>
137   <command>pg_ctl</command>
138   <arg choice="plain"><option>unregister</option></arg>
139   <arg choice="opt"><option>-N</option> <replaceable>servicename</replaceable></arg>
140  </cmdsynopsis>
141 </refsynopsisdiv>
142
143
144 <refsect1 id="app-pg-ctl-description">
145  <title>Description</title>
146  <para>
147   <application>pg_ctl</application> is a utility for initializing a
148   <productname>PostgreSQL</productname> database cluster, starting,
149   stopping, or restarting the <productname>PostgreSQL</productname>
150   database server (<xref linkend="app-postgres"/>), or displaying the
151   status of a running server.  Although the server can be started
152   manually, <application>pg_ctl</application> encapsulates tasks such
153   as redirecting log output and properly detaching from the terminal
154   and process group. It also provides convenient options for
155   controlled shutdown.
156  </para>
157
158  <para>
159   The <option>init</option> or <option>initdb</option> mode creates a new
160   <productname>PostgreSQL</productname> database cluster, that is,
161   a collection of databases that will be managed by a single
162   server instance.  This mode invokes the <command>initdb</command>
163   command.  See <xref linkend="app-initdb"/> for details.
164  </para>
165
166  <para>
167   <option>start</option> mode launches a new server.  The
168   server is started in the background, and its standard input is attached
169   to <filename>/dev/null</filename> (or <literal>nul</literal> on Windows).
170   On Unix-like systems, by default, the server's standard output and
171   standard error are sent to <application>pg_ctl</application>'s
172   standard output (not standard error).  The standard output of
173   <application>pg_ctl</application> should then be redirected to a
174   file or piped to another process such as a log rotating program
175   like <application>rotatelogs</application>; otherwise <command>postgres</command>
176   will write its output to the controlling terminal (from the
177   background) and will not leave the shell's process group.  On
178   Windows, by default the server's standard output and standard error
179   are sent to the terminal.  These default behaviors can be changed
180   by using <option>-l</option> to append the server's output to a log file.
181   Use of either <option>-l</option> or output redirection is recommended.
182  </para>
183
184  <para>
185   <option>stop</option> mode shuts down the server that is running in
186   the specified data directory.  Three different
187   shutdown methods can be selected with the <option>-m</option>
188   option.  <quote>Smart</quote> mode disallows new connections, then waits
189   for all existing clients to disconnect and any online backup to finish.
190   If the server is in hot standby, recovery and streaming replication
191   will be terminated once all clients have disconnected.
192   <quote>Fast</quote> mode (the default) does not wait for clients to disconnect and
193   will terminate an online backup in progress.  All active transactions are
194   rolled back and clients are forcibly disconnected, then the
195   server is shut down.  <quote>Immediate</quote> mode will abort
196   all server processes immediately, without a clean shutdown.  This choice
197   will lead to a crash-recovery cycle during the next server start.
198  </para>
199
200  <para>
201   <option>restart</option> mode effectively executes a stop followed
202   by a start.  This allows changing the <command>postgres</command>
203   command-line options, or changing configuration-file options that
204   cannot be changed without restarting the server.
205   If relative paths were used on the command line during server
206   start, <option>restart</option> might fail unless
207   <application>pg_ctl</application> is executed in the same current
208   directory as it was during server start.
209  </para>
210
211  <para>
212   <option>reload</option> mode simply sends the
213   <command>postgres</command> server process a <systemitem>SIGHUP</systemitem>
214   signal, causing it to reread its configuration files
215   (<filename>postgresql.conf</filename>,
216   <filename>pg_hba.conf</filename>, etc.).  This allows changing
217   configuration-file options that do not require a full server restart
218   to take effect.
219  </para>
220
221  <para>
222   <option>status</option> mode checks whether a server is running in
223   the specified data directory. If it is, the server's <acronym>PID</acronym>
224   and the command line options that were used to invoke it are displayed.
225   If the server is not running, <application>pg_ctl</application> returns
226   an exit status of 3.  If an accessible data directory is not
227   specified, <application>pg_ctl</application> returns an exit status of 4.
228  </para>
229
230  <para>
231   <option>promote</option> mode commands the standby server that is
232   running in the specified data directory to end standby mode
233   and begin read-write operations.
234  </para>
235
236  <para>
237   <option>logrotate</option> mode rotates the server log file.
238   For details on how to use this mode with external log rotation tools, see
239   <xref linkend="logfile-maintenance"/>.
240  </para>
241
242  <para>
243   <option>kill</option> mode sends a signal to a specified process.
244   This is primarily valuable on <productname>Microsoft Windows</productname>
245   which does not have a built-in <application>kill</application> command.  Use
246   <literal>--help</literal> to see a list of supported signal names.
247  </para>
248
249  <para>
250   <option>register</option> mode registers the <productname>PostgreSQL</productname>
251   server as a system service on <productname>Microsoft Windows</productname>.
252   The <option>-S</option> option allows selection of service start type,
253   either <quote>auto</quote> (start service automatically on system startup)
254   or <quote>demand</quote> (start service on demand).
255  </para>
256
257  <para>
258   <option>unregister</option> mode unregisters a system service
259   on <productname>Microsoft Windows</productname>.  This undoes the effects of the
260   <option>register</option> command.
261  </para>
262 </refsect1>
263
264 <refsect1 id="app-pg-ctl-options">
265  <title>Options</title>
266
267    <variablelist>
268
269     <varlistentry>
270      <term><option>-c</option></term>
271      <term><option>--core-files</option></term>
272      <listitem>
273       <para>
274        Attempt to allow server crashes to produce core files, on platforms
275        where this is possible, by lifting any soft resource limit placed on
276        core files.
277        This is useful in debugging or diagnosing problems by allowing a
278        stack trace to be obtained from a failed server process.
279       </para>
280      </listitem>
281     </varlistentry>
282
283     <varlistentry>
284      <term><option>-D <replaceable class="parameter">datadir</replaceable></option></term>
285      <term><option>--pgdata=<replaceable class="parameter">datadir</replaceable></option></term>
286      <listitem>
287       <para>
288        Specifies the file system location of the database configuration files.  If
289        this option is omitted, the environment variable
290        <envar>PGDATA</envar> is used.
291       </para>
292      </listitem>
293     </varlistentry>
294
295     <varlistentry>
296      <term><option>-l <replaceable class="parameter">filename</replaceable></option></term>
297      <term><option>--log=<replaceable class="parameter">filename</replaceable></option></term>
298      <listitem>
299       <para>
300        Append the server log output to
301        <replaceable>filename</replaceable>.  If the file does not
302        exist, it is created.  The <systemitem>umask</systemitem> is set to 077,
303        so access to the log file is disallowed to other users by default.
304       </para>
305      </listitem>
306     </varlistentry>
307
308     <varlistentry>
309      <term><option>-m <replaceable class="parameter">mode</replaceable></option></term>
310      <term><option>--mode=<replaceable class="parameter">mode</replaceable></option></term>
311      <listitem>
312       <para>
313        Specifies the shutdown mode.  <replaceable>mode</replaceable>
314        can be <literal>smart</literal>, <literal>fast</literal>, or
315        <literal>immediate</literal>, or the first letter of one of
316        these three.  If this option is omitted, <literal>fast</literal> is
317        the default.
318       </para>
319      </listitem>
320     </varlistentry>
321
322     <varlistentry>
323      <term><option>-o <replaceable class="parameter">options</replaceable></option></term>
324      <term><option>--options=<replaceable class="parameter">options</replaceable></option></term>
325      <listitem>
326       <para>
327        Specifies options to be passed directly to the
328        <command>postgres</command> command.
329        <option>-o</option> can be specified multiple times, with all the given
330        options being passed through.
331       </para>
332       <para>
333        The <replaceable>options</replaceable> should usually be surrounded by single or
334        double quotes to ensure that they are passed through as a group.
335       </para>
336      </listitem>
337     </varlistentry>
338
339     <varlistentry>
340      <term><option>-o <replaceable class="parameter">initdb-options</replaceable></option></term>
341      <term><option>--options=<replaceable class="parameter">initdb-options</replaceable></option></term>
342      <listitem>
343       <para>
344        Specifies options to be passed directly to the
345        <command>initdb</command> command.
346        <option>-o</option> can be specified multiple times, with all the given
347        options being passed through.
348       </para>
349       <para>
350        The <replaceable>initdb-options</replaceable> should usually be surrounded by single or
351        double quotes to ensure that they are passed through as a group.
352       </para>
353      </listitem>
354     </varlistentry>
355
356     <varlistentry>
357      <term><option>-p <replaceable class="parameter">path</replaceable></option></term>
358      <listitem>
359       <para>
360        Specifies the location of the <filename>postgres</filename>
361        executable.  By default the <filename>postgres</filename> executable is taken from the same
362        directory as <command>pg_ctl</command>, or failing that, the hard-wired
363        installation directory.  It is not necessary to use this
364        option unless you are doing something unusual and get errors
365        that the <filename>postgres</filename> executable was not found.
366       </para>
367
368       <para>
369        In <literal>init</literal> mode, this option analogously
370        specifies the location of the <filename>initdb</filename>
371        executable.
372       </para>
373      </listitem>
374     </varlistentry>
375
376     <varlistentry>
377      <term><option>-s</option></term>
378      <term><option>--silent</option></term>
379      <listitem>
380       <para>
381        Print only errors, no informational messages.
382       </para>
383      </listitem>
384     </varlistentry>
385
386     <varlistentry>
387      <term><option>-t <replaceable class="parameter">seconds</replaceable></option></term>
388      <term><option>--timeout=<replaceable class="parameter">seconds</replaceable></option></term>
389      <listitem>
390       <para>
391        Specifies the maximum number of seconds to wait when waiting for an
392        operation to complete (see option <option>-w</option>).  Defaults to
393        the value of the <envar>PGCTLTIMEOUT</envar> environment variable or, if
394        not set, to 60 seconds.
395       </para>
396      </listitem>
397     </varlistentry>
398
399     <varlistentry>
400      <term><option>-V</option></term>
401      <term><option>--version</option></term>
402       <listitem>
403        <para>
404         Print the <application>pg_ctl</application> version and exit.
405        </para>
406       </listitem>
407     </varlistentry>
408
409     <varlistentry>
410      <term><option>-w</option></term>
411      <term><option>--wait</option></term>
412      <listitem>
413       <para>
414        Wait for the operation to complete.  This is supported for the
415        modes <literal>start</literal>, <literal>stop</literal>,
416        <literal>restart</literal>, <literal>promote</literal>,
417        and <literal>register</literal>, and is the default for those modes.
418       </para>
419
420       <para>
421        When waiting, <command>pg_ctl</command> repeatedly checks the
422        server's <acronym>PID</acronym> file, sleeping for a short amount
423        of time between checks.  Startup is considered complete when
424        the <acronym>PID</acronym> file indicates that the server is ready to
425        accept connections.  Shutdown is considered complete when the server
426        removes the <acronym>PID</acronym> file.
427        <command>pg_ctl</command> returns an exit code based on the
428        success of the startup or shutdown.
429       </para>
430
431       <para>
432        If the operation does not complete within the timeout (see
433        option <option>-t</option>), then <command>pg_ctl</command> exits with
434        a nonzero exit status.  But note that the operation might continue in
435        the background and eventually succeed.
436       </para>
437      </listitem>
438     </varlistentry>
439
440     <varlistentry>
441      <term><option>-W</option></term>
442      <term><option>--no-wait</option></term>
443      <listitem>
444       <para>
445        Do not wait for the operation to complete.  This is the opposite of
446        the option <option>-w</option>.
447       </para>
448
449       <para>
450        If waiting is disabled, the requested action is triggered, but there
451        is no feedback about its success.  In that case, the server log file
452        or an external monitoring system would have to be used to check the
453        progress and success of the operation.
454       </para>
455
456       <para>
457        In prior releases of PostgreSQL, this was the default except for
458        the <literal>stop</literal> mode.
459       </para>
460      </listitem>
461     </varlistentry>
462
463     <varlistentry>
464      <term><option>-?</option></term>
465      <term><option>--help</option></term>
466      <listitem>
467       <para>
468        Show help about <application>pg_ctl</application> command line
469        arguments, and exit.
470       </para>
471      </listitem>
472     </varlistentry>
473   </variablelist>
474
475  <para>
476   If an option is specified that is valid, but not relevant to the selected
477   operating mode, <application>pg_ctl</application> ignores it.
478  </para>
479
480  <refsect2 id="app-pg-ctl-windows-options">
481   <title>Options for Windows</title>
482
483   <variablelist>
484    <varlistentry>
485     <term><option>-e <replaceable class="parameter">source</replaceable></option></term>
486     <listitem>
487      <para>
488       Name of the event source for <application>pg_ctl</application> to use
489       for logging to the event log when running as a Windows service.  The
490       default is <literal>PostgreSQL</literal>.  Note that this only controls
491       messages sent from <application>pg_ctl</application> itself; once
492       started, the server will use the event source specified
493       by its <xref linkend="guc-event-source"/> parameter.  Should the server
494       fail very early in startup, before that parameter has been set,
495       it might also log using the default event
496       source name <literal>PostgreSQL</literal>.
497      </para>
498     </listitem>
499    </varlistentry>
500
501    <varlistentry>
502     <term><option>-N <replaceable class="parameter">servicename</replaceable></option></term>
503     <listitem>
504      <para>
505       Name of the system service to register. This name will be used
506       as both the service name and the display name.
507       The default is <literal>PostgreSQL</literal>.
508      </para>
509     </listitem>
510    </varlistentry>
511
512    <varlistentry>
513     <term><option>-P <replaceable class="parameter">password</replaceable></option></term>
514     <listitem>
515      <para>
516       Password for the user to run the service as.
517      </para>
518     </listitem>
519    </varlistentry>
520
521    <varlistentry>
522     <term><option>-S <replaceable class="parameter">start-type</replaceable></option></term>
523     <listitem>
524      <para>
525       Start type of the system service.  <replaceable>start-type</replaceable> can
526       be <literal>auto</literal>, or <literal>demand</literal>, or
527       the first letter of one of these two. If this option is omitted,
528       <literal>auto</literal> is the default.
529      </para>
530     </listitem>
531    </varlistentry>
532
533    <varlistentry>
534     <term><option>-U <replaceable class="parameter">username</replaceable></option></term>
535     <listitem>
536      <para>
537       User name for the user to run the service as. For domain users, use the
538       format <literal>DOMAIN\username</literal>.
539      </para>
540     </listitem>
541    </varlistentry>
542   </variablelist>
543  </refsect2>
544
545 </refsect1>
546
547
548 <refsect1>
549  <title>Environment</title>
550
551  <variablelist>
552   <varlistentry>
553    <term><envar>PGCTLTIMEOUT</envar></term>
554
555    <listitem>
556     <para>
557      Default limit on the number of seconds to wait when waiting for startup
558      or shutdown to complete.  If not set, the default is 60 seconds.
559     </para>
560    </listitem>
561   </varlistentry>
562
563   <varlistentry>
564    <term><envar>PGDATA</envar></term>
565
566    <listitem>
567     <para>
568      Default data directory location.
569     </para>
570    </listitem>
571   </varlistentry>
572
573  </variablelist>
574
575  <para>
576   Most <command>pg_ctl</command> modes require knowing the data directory
577   location; therefore, the <option>-D</option> option is required
578   unless <envar>PGDATA</envar> is set.
579  </para>
580
581  <para>
582   <command>pg_ctl</command>, like most other <productname>PostgreSQL</productname>
583   utilities,
584   also uses the environment variables supported by <application>libpq</application>
585   (see <xref linkend="libpq-envars"/>).
586  </para>
587
588  <para>
589   For additional variables that affect the server,
590   see <xref linkend="app-postgres"/>.
591  </para>
592 </refsect1>
593
594
595 <refsect1>
596  <title>Files</title>
597
598  <variablelist>
599   <varlistentry>
600    <term><filename>postmaster.pid</filename></term>
601
602    <listitem>
603     <para>
604      <application>pg_ctl</application> examines this file in the data
605      directory to determine whether the server is currently running.
606     </para>
607    </listitem>
608   </varlistentry>
609
610   <varlistentry>
611    <term><filename>postmaster.opts</filename></term>
612
613    <listitem>
614     <para>If this file exists in the data directory,
615      <application>pg_ctl</application> (in <option>restart</option> mode)
616      will pass the contents of the file as options to
617      <application>postgres</application>, unless overridden
618      by the <option>-o</option> option. The contents of this file
619      are also displayed in <option>status</option> mode.
620     </para>
621    </listitem>
622   </varlistentry>
623
624  </variablelist>
625 </refsect1>
626
627
628 <refsect1 id="r1-app-pgctl-2">
629  <title>Examples</title>
630
631  <refsect2 id="r2-app-pgctl-3">
632   <title>Starting the Server</title>
633
634   <para>
635    To start the server, waiting until the server is
636    accepting connections:
637<screen>
638<prompt>$</prompt> <userinput>pg_ctl start</userinput>
639</screen>
640   </para>
641
642   <para>
643    To start the server using port 5433, and
644    running without <function>fsync</function>, use:
645<screen>
646<prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" start</userinput>
647</screen></para>
648  </refsect2>
649
650  <refsect2 id="r2-app-pgctl-4">
651   <title>Stopping the Server</title>
652   <para>
653    To stop the server, use:
654<screen>
655<prompt>$</prompt> <userinput>pg_ctl stop</userinput>
656</screen>
657    The <option>-m</option> option allows control over
658    <emphasis>how</emphasis> the server shuts down:
659<screen>
660<prompt>$</prompt> <userinput>pg_ctl stop -m smart</userinput>
661</screen></para>
662  </refsect2>
663
664  <refsect2 id="r2-app-pgctl-5">
665   <title>Restarting the Server</title>
666
667   <para>
668    Restarting the server is almost equivalent to stopping the
669    server and starting it again, except that by default,
670    <command>pg_ctl</command> saves and reuses the command line options that
671    were passed to the previously-running instance.  To restart
672    the server using the same options as before, use:
673<screen>
674<prompt>$</prompt> <userinput>pg_ctl restart</userinput>
675</screen>
676   </para>
677
678   <para>
679    But if <option>-o</option> is specified, that replaces any previous options.
680    To restart using port 5433, disabling <function>fsync</function> upon restart:
681<screen>
682<prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" restart</userinput>
683</screen></para>
684  </refsect2>
685
686  <refsect2 id="r2-app-pgctl-6">
687   <title>Showing the Server Status</title>
688
689   <para>
690    Here is sample status output from
691    <application>pg_ctl</application>:
692<screen>
693<prompt>$</prompt> <userinput>pg_ctl status</userinput>
694<computeroutput>
695pg_ctl: server is running (PID: 13718)
696/usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" "-p" "5433" "-B" "128"
697</computeroutput></screen>
698    The second line is the command that would be invoked in restart mode.
699   </para>
700  </refsect2>
701 </refsect1>
702
703
704 <refsect1>
705  <title>See Also</title>
706
707  <simplelist type="inline">
708   <member><xref linkend="app-initdb"/></member>
709   <member><xref linkend="app-postgres"/></member>
710  </simplelist>
711 </refsect1>
712
713</refentry>
714