Skip to content

Commit 196700c

Browse files
committed
Add 'reload' option to pg_ctl to send SIGHUP to the postmaster.
1 parent c1c888a commit 196700c

File tree

3 files changed

+42
-16
lines changed

3 files changed

+42
-16
lines changed

doc/src/sgml/client-auth.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.20 2001/09/21 20:31:41 tgl Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.21 2001/09/21 21:10:56 tgl Exp $ -->
22

33
<chapter id="client-authentication">
44
<title>Client Authentication</title>
@@ -333,9 +333,10 @@ hostssl <replaceable>database</replaceable> <replaceable>IP-address</replaceable
333333

334334
<para>
335335
The <filename>pg_hba.conf</filename> file is loaded only on startup
336-
and when the <application>postmaster</> receives a <systemitem>SIGHUP</systemitem> signal. If
337-
you edit the file on an active system, you will need to issue a
338-
<systemitem>SIGHUP</systemitem> to the <application>postmaster</> using <application>kill</>
336+
and when the <application>postmaster</> receives a
337+
<systemitem>SIGHUP</systemitem> signal. If you edit the file on an
338+
active system, you will need to signal the <application>postmaster</>
339+
(using <application>pg_ctl reload</> or <application>kill -HUP</>)
339340
to make it re-read the file.
340341
</para>
341342

doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.8 2001/09/03 12:57:50 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.9 2001/09/21 21:10:56 tgl Exp $
33
Postgres documentation
44
-->
55

@@ -58,6 +58,11 @@ Postgres documentation
5858
<arg>-o <replaceable>options</replaceable></arg>
5959
<sbr>
6060
<command>pg_ctl</command>
61+
<arg choice="plain">reload</arg>
62+
<arg>-s</arg>
63+
<arg>-D <replaceable>datadir</replaceable></arg>
64+
<sbr>
65+
<command>pg_ctl</command>
6166
<arg choice="plain">status</arg>
6267
<arg>-D <replaceable>datadir</replaceable></arg>
6368
</cmdsynopsis>
@@ -73,7 +78,7 @@ Postgres documentation
7378
the status of a running postmaster. Although the postmaster can be
7479
started manually, <application>pg_ctl</application> encapulates
7580
tasks such as redirecting log output, properly detaching from the
76-
terminal and process group, and additionally provides an option for
81+
terminal and process group, and it provides convenient options for
7782
controlled shut down.
7883
</para>
7984

@@ -93,15 +98,14 @@ Postgres documentation
9398
</para>
9499

95100
<para>
96-
In <option>stop</option> mode, the postmaster that is running on
101+
In <option>stop</option> mode, the postmaster that is running in
97102
the specified data directory is shut down. Three different
98103
shutdown methods can be selected with the <option>-m</option>
99104
option: <quote>Smart</quote> mode waits for all the clients to
100105
disconnect. This is the default. <quote>Fast</quote> mode does
101106
not wait for clients to disconnect. All active transactions will
102107
be rolled back. <quote>Immediate</quote> mode will abort without
103108
complete shutdown. This will lead to a recovery run on restart.
104-
By the default, stop mode waits for the shutdown to complete.
105109
</para>
106110

107111
<para>
@@ -110,6 +114,14 @@ Postgres documentation
110114
options.
111115
</para>
112116

117+
<para>
118+
<option>reload</option> mode simply sends the postmaster a SIGHUP signal,
119+
causing it to reread its configuration files
120+
(<filename>postgresql.conf</filename>, <filename>pg_hba.conf</filename>,
121+
etc). This allows changing of configuration-file options that do not
122+
require a complete restart to take effect.
123+
</para>
124+
113125
<para>
114126
<option>status</option> mode checks whether a postmaster is running
115127
and if so displays the <acronym>PID</acronym> and the command line
@@ -188,7 +200,7 @@ Postgres documentation
188200
<term>-w</term>
189201
<listitem>
190202
<para>
191-
Wait for the start or stutdown to complete. Times out after
203+
Wait for the start or shutdown to complete. Times out after
192204
60 seconds. This is the default for shutdowns.
193205
</para>
194206
</listitem>

src/bin/pg_ctl/pg_ctl.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22
#-------------------------------------------------------------------------
33
#
44
# pg_ctl.sh--
5-
# Start/Stop/Restart/Report status of postmaster
5+
# Start/Stop/Restart/HUP/Report status of postmaster
66
#
77
# Copyright (c) 2001 PostgreSQL Global Development Group
88
#
99
#
1010
# IDENTIFICATION
11-
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.23 2001/07/11 19:36:41 momjian Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.24 2001/09/21 21:10:56 tgl Exp $
1212
#
1313
#-------------------------------------------------------------------------
1414

1515
CMDNAME=`basename $0`
1616

1717
help="\
18-
$CMDNAME is a utility to start, stop, restart, and report the status
19-
of a PostgreSQL server.
18+
$CMDNAME is a utility to start, stop, restart, reload configuration files,
19+
or report the status of a PostgreSQL server.
2020
2121
Usage:
2222
$CMDNAME start [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]
2323
$CMDNAME stop [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
2424
$CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o \"OPTIONS\"]
25+
$CMDNAME reload [-D DATADIR] [-s]
2526
$CMDNAME status [-D DATADIR]
2627
2728
Common options:
@@ -174,6 +175,9 @@ do
174175
restart)
175176
op="restart"
176177
;;
178+
reload)
179+
op="reload"
180+
;;
177181
status)
178182
op="status"
179183
;;
@@ -224,6 +228,10 @@ case "$shutdown_mode" in
224228
;;
225229
esac
226230

231+
if [ "$op" = "reload" ];then
232+
sig="-HUP"
233+
wait=no
234+
fi
227235

228236
DEFPOSTOPTS=$PGDATA/postmaster.opts.default
229237
POSTOPTSFILE=$PGDATA/postmaster.opts
@@ -247,7 +255,7 @@ if [ "$op" = "status" ];then
247255
fi
248256
fi
249257

250-
if [ "$op" = "stop" -o "$op" = "restart" ];then
258+
if [ "$op" = "stop" -o "$op" = "restart" -o "$op" = "reload" ];then
251259
if [ -f $PIDFILE ];then
252260
PID=`sed -n 1p $PIDFILE`
253261
if [ $PID -lt 0 ];then
@@ -281,7 +289,12 @@ if [ "$op" = "stop" -o "$op" = "restart" ];then
281289
done
282290
$silence_echo echo "done"
283291
fi
284-
$silence_echo echo "postmaster successfully shut down"
292+
293+
if [ "$op" = "reload" ];then
294+
$silence_echo echo "postmaster successfully signaled"
295+
else
296+
$silence_echo echo "postmaster successfully shut down"
297+
fi
285298

286299
else # ! -f $PIDFILE
287300
echo "$CMDNAME: cannot find $PIDFILE" 1>&2
@@ -292,7 +305,7 @@ if [ "$op" = "stop" -o "$op" = "restart" ];then
292305
exit 1
293306
fi
294307
fi
295-
fi # stop or restart
308+
fi # stop, restart, reload
296309

297310
if [ "$op" = "start" -o "$op" = "restart" ];then
298311
oldpid=""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy