]> begriffs open source - ai-pg/blob - full-docs/txt/app-pg-isready.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / app-pg-isready.txt
1
2 pg_isready
3
4    pg_isready — check the connection status of a PostgreSQL server
5
6 Synopsis
7
8    pg_isready [connection-option...] [option...]
9
10 Description
11
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
16 Options
17
18    -d dbname
19           --dbname=dbname
20           Specifies the name of the database to connect to. The dbname can
21           be a connection string. If so, connection string parameters will
22           override any conflicting command line options.
23
24    -h hostname
25           --host=hostname
26           Specifies the host name of the machine on which the server is
27           running. If the value begins with a slash, it is used as the
28           directory for the Unix-domain socket.
29
30    -p port
31           --port=port
32           Specifies the TCP port or the local Unix-domain socket file
33           extension on which the server is listening for connections.
34           Defaults to the value of the PGPORT environment variable or, if
35           not set, to the port specified at compile time, usually 5432.
36
37    -q
38           --quiet
39           Do not display status message. This is useful when scripting.
40
41    -t seconds
42           --timeout=seconds
43           The maximum number of seconds to wait when attempting connection
44           before returning that the server is not responding. Setting to 0
45           disables. The default is 3 seconds.
46
47    -U username
48           --username=username
49           Connect to the database as the user username instead of the
50           default.
51
52    -V
53           --version
54           Print the pg_isready version and exit.
55
56    -?
57           --help
58           Show help about pg_isready command line arguments, and exit.
59
60 Exit Status
61
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
68 Environment
69
70    pg_isready, like most other PostgreSQL utilities, also uses the
71    environment variables supported by libpq (see Section 32.15).
72
73    The environment variable PG_COLOR specifies whether to use color in
74    diagnostic messages. Possible values are always, auto and never.
75
76 Notes
77
78    It is not necessary to supply correct user name, password, or database
79    name values to obtain the server status; however, if incorrect values
80    are provided, the server will log a failed connection attempt.
81
82 Examples
83
84    Standard Usage:
85 $ pg_isready
86 /tmp:5432 - accepting connections
87 $ echo $?
88 0
89
90    Running with connection parameters to a PostgreSQL cluster in startup:
91 $ pg_isready -h localhost -p 5433
92 localhost:5433 - rejecting connections
93 $ echo $?
94 1
95
96    Running with connection parameters to a non-responsive PostgreSQL
97    cluster:
98 $ pg_isready -h someremotehost
99 someremotehost:5432 - no response
100 $ echo $?
101 2