1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.5 2000/12/25 23:15:26 petere Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.6 2001/02/08 19:39:24 petere Exp $
3
3
Postgres documentation
4
4
-->
5
5
6
6
<refentry id="app-pg-ctl">
7
7
<docinfo>
8
- <date>2000-11-25 </date>
8
+ <date>2001-02-08 </date>
9
9
</docinfo>
10
10
11
11
<refmeta>
@@ -25,12 +25,13 @@ Postgres documentation
25
25
<arg choice="plain">start</arg>
26
26
<arg>-w</arg>
27
27
<arg>-D <replaceable>datadir</replaceable></arg>
28
- <arg>-p <replaceable>path </replaceable></arg>
28
+ <arg>-l <replaceable>filename </replaceable></arg>
29
29
<arg>-o <replaceable>options</replaceable></arg>
30
+ <arg>-p <replaceable>path</replaceable></arg>
30
31
<sbr>
31
32
<command>pg_ctl</command>
32
33
<arg choice="plain">stop</arg>
33
- <arg>-w </arg>
34
+ <arg>-W </arg>
34
35
<arg>-D <replaceable>datadir</replaceable></arg>
35
36
<arg>-m
36
37
<group choice="plain">
@@ -64,8 +65,52 @@ Postgres documentation
64
65
<title>Description</title>
65
66
<para>
66
67
<application>pg_ctl</application> is a utility for starting,
67
- stopping, or restarting the <xref linkend="app-postmaster">, or
68
- displaying the status of a running postmaster.
68
+ stopping, or restarting <xref linkend="app-postmaster">, the
69
+ <productname>PostgreSQL</productname> backend server, or displaying
70
+ the status of a running postmaster. Although the postmaster can be
71
+ started manually, <application>pg_ctl</application> encapulates
72
+ tasks such as redirecting log output, properly detaching from the
73
+ terminal and process group, and additionally provides an option for
74
+ controlled shut down.
75
+ </para>
76
+
77
+ <para>
78
+ In <option>start</option> mode, a new postmaster is launched. The
79
+ server is started in the background, the standard input attached to
80
+ <filename>/dev/null</filename>. The standard output and standard
81
+ error are either appended to a log file, if the <option>-l</option>
82
+ option is used, or are redirected to
83
+ <application>pg_ctl</application>'s standard output (not standard
84
+ error). If no log file is chosen, the standard output of
85
+ <application>pg_ctl</application> should be redirected to a file or
86
+ piped to another process, for example a log rotating program,
87
+ otherwise the postmaster will write its output the the controlling
88
+ terminal (from the background) and will not leave the shell's
89
+ process group.
90
+ </para>
91
+
92
+ <para>
93
+ In <option>stop</option> mode, the postmaster that is running on
94
+ the specified data directory is shut down. Three different
95
+ shutdown methods can be selected with the <option>-m</option>
96
+ option: <quote>Smart</quote> mode waits for all the clients to
97
+ disconnect. This is the default. <quote>Fast</quote> mode does
98
+ not wait for clients to disconnect. All active transactions will
99
+ be rolled back. <quote>Immediate</quote> mode will abort without
100
+ complete shutdown. This will lead to a recovery run on restart.
101
+ By the default, stop mode waits for the shutdown to complete.
102
+ </para>
103
+
104
+ <para>
105
+ <option>restart</option> mode effectively executes a stop followed
106
+ by a start. This allows the changing of postmaster command line
107
+ options.
108
+ </para>
109
+
110
+ <para>
111
+ <option>status</option> mode checks whether a postmaster is running
112
+ and if so displays the <acronym>PID</acronym> and the command line
113
+ options that were used to invoke it.
69
114
</para>
70
115
71
116
<refsect2 id="app-pg-ctl-options">
@@ -74,38 +119,36 @@ Postgres documentation
74
119
75
120
<variablelist>
76
121
<varlistentry>
77
- <term>-w </term>
122
+ <term>-D <replaceable class="parameter">datadir</replaceable> </term>
78
123
<listitem>
79
124
<para>
80
- Wait for the database server to come up, by watching for
81
- creation of the pid file
82
- (<filename><replaceable>PGDATA</replaceable>/postmaster.pid</filename>).
83
- Times out after 60 seconds.
125
+ Specifies the file system location of the database files. If
126
+ this is omitted, the environment variable
127
+ <envar>PGDATA</envar> is used.
84
128
</para>
85
129
</listitem>
86
130
</varlistentry>
87
131
88
132
<varlistentry>
89
- <term>-D <replaceable class="parameter">datadir </replaceable></term>
133
+ <term>-l <replaceable class="parameter">filename </replaceable></term>
90
134
<listitem>
91
135
<para>
92
- Specifies the file system location of the database files. If
93
- this is omitted, the environment variable
94
- <envar>PGDATA</envar> is used.
136
+ Append the server log output to
137
+ <replaceable>filename</replaceable>. If the file does not
138
+ exist, it is created. The umask is set to 077, so access to
139
+ the log file from other users is disallowed by default.
95
140
</para>
96
141
</listitem>
97
142
</varlistentry>
98
143
99
144
<varlistentry>
100
- <term>-p <replaceable class="parameter">path </replaceable></term>
145
+ <term>-m <replaceable class="parameter">mode </replaceable></term>
101
146
<listitem>
102
147
<para>
103
- Specifies the location of the <filename>postmaster</filename>
104
- executable. By default the postmaster is taken from the same
105
- directory as pg_ctl, or failing that, the hard-wired
106
- installation directory. It is not necessary to use this
107
- option unless you are doing something unusual and get errors
108
- that the postmaster was not found.
148
+ Specifies the shutdown mode. <replaceable>mode</replaceable>
149
+ may be <literal>smart</literal>, <literal>fast</literal>, or
150
+ <literal>immediate</literal>, or the first letter of one of
151
+ these three.
109
152
</para>
110
153
</listitem>
111
154
</varlistentry>
@@ -125,82 +168,35 @@ Postgres documentation
125
168
</varlistentry>
126
169
127
170
<varlistentry>
128
- <term>-m <replaceable class="parameter">mode</replaceable></term>
129
- <listitem>
130
- <para>
131
- Specifies the shutdown mode.
132
-
133
- <variablelist>
134
- <varlistentry>
135
- <term>smart</term>
136
- <term>s</term>
137
- <listitem>
138
- <para>
139
- Smart mode waits for all the clients to disconnect. This
140
- is the default.
141
- </para>
142
- </listitem>
143
- </varlistentry>
144
-
145
- <varlistentry>
146
- <term>fast</term>
147
- <term>f</term>
148
- <listitem>
149
- <para>
150
- Fast mode does not wait for clients to disconnect. All
151
- active transactions will be rolled back.
152
- </para>
153
- </listitem>
154
- </varlistentry>
155
-
156
- <varlistentry>
157
- <term>immediate</term>
158
- <term>i</term>
159
- <listitem>
160
- <para>
161
- Immediate mode will abort without complete shutdown. This
162
- will lead to a recovery run on restart.
163
- </para>
164
- </listitem>
165
- </varlistentry>
166
- </variablelist>
167
- </para>
168
- </listitem>
169
- </varlistentry>
170
-
171
- <varlistentry>
172
- <term>start</term>
173
- <listitem>
174
- <para>
175
- Start up <application>postmaster</application>.
176
- </para>
177
- </listitem>
178
- </varlistentry>
179
-
180
- <varlistentry>
181
- <term>stop</term>
171
+ <term>-p <replaceable class="parameter">path</replaceable></term>
182
172
<listitem>
183
173
<para>
184
- Shut down <application>postmaster</application>.
174
+ Specifies the location of the <filename>postmaster</filename>
175
+ executable. By default the postmaster is taken from the same
176
+ directory as pg_ctl, or failing that, the hard-wired
177
+ installation directory. It is not necessary to use this
178
+ option unless you are doing something unusual and get errors
179
+ that the postmaster was not found.
185
180
</para>
186
181
</listitem>
187
182
</varlistentry>
188
183
189
184
<varlistentry>
190
- <term>restart </term>
185
+ <term>-w </term>
191
186
<listitem>
192
187
<para>
193
- Stop the <application>postmaster</application>, if one is running,
194
- and then start it again .
188
+ Wait for the start or stutdown to complete. Times out after
189
+ 60 seconds. This is the default for shutdowns .
195
190
</para>
196
191
</listitem>
197
192
</varlistentry>
198
193
199
194
<varlistentry>
200
- <term>status </term>
195
+ <term>-W </term>
201
196
<listitem>
202
197
<para>
203
- Show the current state of <application>postmaster</application>.
198
+ Do not wait for start or shutdown to complete. This is the
199
+ default for starts and restarts.
204
200
</para>
205
201
</listitem>
206
202
</varlistentry>
@@ -223,7 +219,7 @@ Postgres documentation
223
219
224
220
225
221
<refsect1 id="R1-APP-PGCTL-2">
226
- <title>Usage </title>
222
+ <title>Examples </title>
227
223
228
224
<refsect2 id="R2-APP-PGCTL-3">
229
225
<title>Starting the postmaster</title>
@@ -260,7 +256,6 @@ Postgres documentation
260
256
</screen>
261
257
stops postmaster. Using the <option>-m</option> switch allows one
262
258
to control <emphasis>how</emphasis> the backend shuts down.
263
- <option>-w</option> waits for postmaster to shut down.
264
259
</para>
265
260
</refsect2>
266
261
@@ -312,6 +307,25 @@ Command line was:
312
307
</para>
313
308
</refsect2>
314
309
</refsect1>
310
+
311
+ <refsect1>
312
+ <title>Bugs</title>
313
+
314
+ <para>
315
+ Waiting for complete start is not a well-defined operation and may
316
+ fail if access control is set up in way that a local client cannot
317
+ connect without manual interaction. It should be avoided.
318
+ </para>
319
+ </refsect1>
320
+
321
+ <refsect1>
322
+ <title>See Also</title>
323
+
324
+ <para>
325
+ <xref linkend="app-postmaster">, <citetitle>PostgreSQL Administrator's Guide</citetitle>
326
+ </para>
327
+ </refsect1>
328
+
315
329
</refentry>
316
330
317
331
<!-- Keep this comment at the end of the file
0 commit comments