Penguin
Annotated edit history of pg_ctl(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 PG_CTL
2 !!!PG_CTL
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 EXAMPLES
7 BUGS
8 SEE ALSO
9 ----
10 !!NAME
11
12
13 pg_ctl - start, stop, or restart a PostgreSQL server
14 !!SYNOPSIS
15
16
17 __pg_ctl start__ [[ __-w__ ] [[ __-s__ ] [[ __-D__
18 ''datadir'' ] [[ __-l__ ''filename'' ] [[ __-o__
19 ''options'' ] [[ __-p__ ''path'' ]
20
21
22 __pg_ctl stop__ [[ __-W__ ] [[ __-s__ ] [[ __-D__
23 ''datadir'' ] [[ __-m s[[mart]__ | __f[[ast]__ |
24 __i[[mmediate]__ ]
25
26
27 __pg_ctl restart__ [[ __-w__ ] [[ __-s__ ] [[
28 __-D__ ''datadir'' ] [[ __-m s[[mart]__ |
29 __f[[ast]__ | __i[[mmediate]__ ] [[ __-o__
30 ''options'' ]
31
32
33 __pg_ctl reload__ [[ __-s__ ] [[ __-D__
34 ''datadir'' ]
35
36
37 __pg_ctl status__ [[ __-D__ ''datadir''
38 ]
39 !!DESCRIPTION
40
41
42 __pg_ctl__ is a utility for starting, stopping, or
43 restarting postmaster(1), the PostgreSQL backend
44 server, or displaying the status of a running postmaster.
45 Although the postmaster can be started manually,
46 __pg_ctl__ encapulates tasks such as redirecting log
47 output, properly detaching from the terminal and process
48 group, and it provides convenient options for controlled
49 shutdown.
50
51
52 In __start__ mode, a new postmaster is launched. The
53 server is started in the background, the standard input
54 attached to ''/dev/null''. The standard output and
55 standard error are either appended to a log file, if the
56 __-l__ option is used, or are redirected to
57 __pg_ctl__'s standard output (not standard error). If no
58 log file is chosen, the standard output of __pg_ctl__
59 should be redirected to a file or piped to another process,
60 for example a log rotating program, otherwise the postmaster
61 will write its output the the controlling terminal (from the
62 background) and will not leave the shell's process
63 group.
64
65
66 In __stop__ mode, the postmaster that is running in the
67 specified data directory is shut down. Three different
68 shutdown methods can be selected with the __-m__ option:
69 ``Smart'' mode waits for all the clients to disconnect. This
70 is the default. ``Fast'' mode does not wait for clients to
71 disconnect. All active transactions are rolled back and
72 clients are forcibly disconnected, then the database is shut
73 down. ``Immediate'' mode will abort all server processes
74 without clean shutdown. This will lead to a recovery run on
75 restart.
76
77
78 __restart__ mode effectively executes a stop followed by
79 a start. This allows the changing of postmaster command line
80 options.
81
82
83 __reload__ mode simply sends the postmaster a
84 __SIGHUP__ signal, causing it to reread its configuration
85 files (''postgresql.conf'', ''pg_hba.conf'', etc.).
86 This allows changing of configuration-file options that do
87 not require a complete restart to take effect.
88
89
90 __status__ mode checks whether a postmaster is running
91 and if so displays the PID and the command line options that
92 were used to invoke it.
93
94
95 __OPTIONS__
96
97
98 __-D__ ''datadir''
99
100
101 Specifies the file system location of the database files. If
102 this is omitted, the environment variable __PGDATA__ is
103 used.
104
105
106 __-l__ ''filename''
107
108
109 Append the server log output to ''filename''. If the file
110 does not exist, it is created. The umask is set to 077, so
111 access to the log file from other users is disallowed by
112 default.
113
114
115 __-m__ ''mode''
116
117
118 Specifies the shutdown mode. ''mode'' may be smart, fast,
119 or immediate, or the first letter of one of these
120 three.
121
122
123 __-o__ ''options''
124
125
126 Specifies options to be passed directly to
127 __postmaster__.
128
129
130 The parameters are usually surrounded by single or double
131 quotes to ensure that they are passed through as a
132 group.
133
134
135 __-p__ ''path''
136
137
138 Specifies the location of the ''postmaster'' executable.
139 By default the postmaster is taken from the same directory
140 as pg_ctl, or failing that, the hard-wired installation
141 directory. It is not necessary to use this option unless you
142 are doing something unusual and get errors that the
143 postmaster was not found.
144
145
146 __-s__
147
148
149 Only print errors, no informational messages.
150
151
152 __-w__
153
154
155 Wait for the start or shutdown to complete. Times out after
156 60 seconds. This is the default for shutdowns.
157
158
159 __-W__
160
161
162 Do not wait for start or shutdown to complete. This is the
163 default for starts and restarts.
164
165
166 __FILES__
167
168
169 If the file ''postmaster.opts.default'' exists in the
170 data directory, the contents of the file will be passed as
171 options to the __postmaster__, unless overridden by the
172 __-o__ option.
173 !!EXAMPLES
174
175
176 __STARTING THE POSTMASTER__
177
178
179 To start up a __postmaster__:
180
181
182 $ __pg_ctl start
183 __An example of starting the __postmaster__, blocking until the postmaster comes up is:
184
185
186 $ __pg_ctl -w start
187 __For a __postmaster__ using port 5433, and running without __fsync__, use:
188
189
190 $ __pg_ctl -o
191 __
192
193
194 __STOPPING THE POSTMASTER__
195
196
197 $ __pg_ctl stop
198 __stops the postmaster. Using the __-m__ switch allows one to control __how__ the backend shuts down.
199
200
201 __RESTARTING THE POSTMASTER__
202
203
204 This is almost equivalent to stopping the __postmaster__
205 and starting it again except that pg_ctl saves and reuses
206 the command line options that were passed to the previously
207 running instance. To restart the __postmaster__ in the
208 simplest form:
209
210
211 $ __pg_ctl restart
212 __To restart __postmaster__, waiting for it to shut down and to come up:
213
214
215 $ __pg_ctl -w restart
216 __To restart using port 5433 and disabling fsync after restarting:
217
218
219 $ __pg_ctl -o
220 __
221
222
223 __SHOWING POSTMASTER STATUS__
224
225
226 Here is a sample status output from
227 __pg_ctl__:
228
229
230 $ __pg_ctl status
231 __pg_ctl: postmaster is running (pid: 13718)
232 Command line was:
233 /usr/local/pgsql/bin/postmaster '-D' '/usr/local/pgsql/data' '-p' '5433' '-B' '128'
234 This is the command line that would be invoked in restart mode.
235 !!BUGS
236
237
238 Waiting for complete start is not a well-defined operation
239 and may fail if access control is set up so that a local
240 client cannot connect without manual interaction. It should
241 be avoided.
242 !!SEE ALSO
243
244
245 postmaster(1), ''PostgreSQL Administrator's
246 Guide''
247 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.