3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "PG_ISREADY" "1" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 pg_isready \- check the connection status of a PostgreSQL server
33 .HP \w'\fBpg_isready\fR\ 'u
34 \fBpg_isready\fR [\fIconnection\-option\fR...] [\fIoption\fR...]
38 is a utility for checking the connection status of a
40 database server\&. The exit status specifies the result of the connection check\&.
43 \fB\-d \fR\fB\fIdbname\fR\fR
45 \fB\-\-dbname=\fR\fB\fIdbname\fR\fR
47 Specifies the name of the database to connect to\&. The
50 connection string\&. If so, connection string parameters will override any conflicting command line options\&.
53 \fB\-h \fR\fB\fIhostname\fR\fR
55 \fB\-\-host=\fR\fB\fIhostname\fR\fR
57 Specifies the host name of the machine on which the server is running\&. If the value begins with a slash, it is used as the directory for the Unix\-domain socket\&.
60 \fB\-p \fR\fB\fIport\fR\fR
62 \fB\-\-port=\fR\fB\fIport\fR\fR
64 Specifies the TCP port or the local Unix\-domain socket file extension on which the server is listening for connections\&. Defaults to the value of the
66 environment variable or, if not set, to the port specified at compile time, usually 5432\&.
73 Do not display status message\&. This is useful when scripting\&.
76 \fB\-t \fR\fB\fIseconds\fR\fR
78 \fB\-\-timeout=\fR\fB\fIseconds\fR\fR
80 The maximum number of seconds to wait when attempting connection before returning that the server is not responding\&. Setting to 0 disables\&. The default is 3 seconds\&.
83 \fB\-U \fR\fB\fIusername\fR\fR
85 \fB\-\-username=\fR\fB\fIusername\fR\fR
87 Connect to the database as the user
89 instead of the default\&.
107 command line arguments, and exit\&.
114 to the shell if the server is accepting connections normally,
116 if the server is rejecting connections (for example during startup),
118 if there was no response to the connection attempt, and
120 if no attempt was made (for example due to invalid parameters)\&.
123 \fBpg_isready\fR, like most other
125 utilities, also uses the environment variables supported by
130 The environment variable
132 specifies whether to use color in diagnostic messages\&. Possible values are
139 It is not necessary to supply correct user name, password, or database name values to obtain the server status; however, if incorrect values are provided, the server will log a failed connection attempt\&.
149 /tmp:5432 \- accepting connections
157 Running with connection parameters to a
165 $ \fBpg_isready \-h localhost \-p 5433\fR
166 localhost:5433 \- rejecting connections
174 Running with connection parameters to a non\-responsive
182 $ \fBpg_isready \-h someremotehost\fR
183 someremotehost:5432 \- no response