1PG_ISREADY(1)            PostgreSQL 12.2 Documentation           PG_ISREADY(1)
2
3
4

NAME

6       pg_isready - check the connection status of a PostgreSQL server
7

SYNOPSIS

9       pg_isready [connection-option...] [option...]
10

DESCRIPTION

12       pg_isready is a utility for checking the connection status of a
13       PostgreSQL database server. The exit status specifies the result of the
14       connection check.
15

OPTIONS

17       -d dbname
18       --dbname=dbname
19           Specifies the name of the database to connect to.
20
21           If this parameter contains an = sign or starts with a valid URI
22           prefix (postgresql:// or postgres://), it is treated as a conninfo
23           string. See Section 33.1.1 for more information.
24
25       -h hostname
26       --host=hostname
27           Specifies the host name of the machine on which the server is
28           running. If the value begins with a slash, it is used as the
29           directory for the Unix-domain socket.
30
31       -p port
32       --port=port
33           Specifies the TCP port or the local Unix-domain socket file
34           extension on which the server is listening for connections.
35           Defaults to the value of the PGPORT environment variable or, if not
36           set, to the port specified at compile time, usually 5432.
37
38       -q
39       --quiet
40           Do not display status message. This is useful when scripting.
41
42       -t seconds
43       --timeout=seconds
44           The maximum number of seconds to wait when attempting connection
45           before returning that the server is not responding. Setting to 0
46           disables. The default is 3 seconds.
47
48       -U username
49       --username=username
50           Connect to the database as the user username instead of the
51           default.
52
53       -V
54       --version
55           Print the pg_isready version and exit.
56
57       -?
58       --help
59           Show help about pg_isready command line arguments, and exit.
60

EXIT STATUS

62       pg_isready returns 0 to the shell if the server is accepting
63       connections normally, 1 if the server is rejecting connections (for
64       example during startup), 2 if there was no response to the connection
65       attempt, and 3 if no attempt was made (for example due to invalid
66       parameters).
67

ENVIRONMENT

69       pg_isready, like most other PostgreSQL utilities, also uses the
70       environment variables supported by libpq (see Section 33.14).
71
72       The environment variable PG_COLOR specifies whether to use color in
73       diagnostics messages. Possible values are always, auto, never.
74

NOTES

76       It is not necessary to supply correct user name, password, or database
77       name values to obtain the server status; however, if incorrect values
78       are provided, the server will log a failed connection attempt.
79

EXAMPLES

81       Standard Usage:
82
83           $ pg_isready
84           /tmp:5432 - accepting connections
85           $ echo $?
86           0
87
88       Running with connection parameters to a PostgreSQL cluster in startup:
89
90           $ pg_isready -h localhost -p 5433
91           localhost:5433 - rejecting connections
92           $ echo $?
93           1
94
95       Running with connection parameters to a non-responsive PostgreSQL
96       cluster:
97
98           $ pg_isready -h someremotehost
99           someremotehost:5432 - no response
100           $ echo $?
101           2
102
103
104
105
106
107PostgreSQL 12.2                      2020                        PG_ISREADY(1)
Impressum