D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
td-agent
/
embedded
/
share
/
man
/
man1
/
Filename :
pg_isready.1
back
Copy
'\" t .\" Title: pg_isready .\" Author: The PostgreSQL Global Development Group .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/> .\" Date: 2014 .\" Manual: PostgreSQL 9.3.5 Documentation .\" Source: PostgreSQL 9.3.5 .\" Language: English .\" .TH "PG_ISREADY" "1" "2014" "PostgreSQL 9.3.5" "PostgreSQL 9.3.5 Documentation" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" pg_isready \- check the connection status of a PostgreSQL server .\" pg_isready .SH "SYNOPSIS" .HP \w'\fBpg_isready\fR\ 'u \fBpg_isready\fR [\fIconnection\-option\fR...] [\fIoption\fR...] .SH "DESCRIPTION" .PP pg_isready is a utility for checking the connection status of a PostgreSQL database server\&. The exit status specifies the result of the connection check\&. .SH "OPTIONS" .PP \fB\-d \fR\fB\fIdbname\fR\fR, \fB\-\-dbname=\fR\fB\fIdbname\fR\fR .RS 4 Specifies the name of the database to connect to\&. .sp If this parameter contains an = sign or starts with a valid URI prefix (postgresql:// or postgres://), it is treated as a \fIconninfo\fR string\&. See Section 31.1.1, \(lqConnection Strings\(rq, in the documentation for more information\&. .RE .PP \fB\-h \fR\fB\fIhostname\fR\fR, \fB\-\-host=\fR\fB\fIhostname\fR\fR .RS 4 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\&. .RE .PP \fB\-p \fR\fB\fIport\fR\fR, \fB\-\-port=\fR\fB\fIport\fR\fR .RS 4 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 \fBPGPORT\fR environment variable or, if not set, to the port specified at compile time, usually 5432\&. .RE .PP \fB\-q\fR, \fB\-\-quiet\fR .RS 4 Do not display status message\&. This is useful when scripting\&. .RE .PP \fB\-t \fR\fB\fIseconds\fR\fR, \fB\-\-timeout=\fR\fB\fIseconds\fR\fR .RS 4 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\&. .RE .PP \fB\-U \fR\fB\fIusername\fR\fR, \fB\-\-username=\fR\fB\fIusername\fR\fR .RS 4 Connect to the database as the user \fIusername\fR instead of the default\&. .RE .PP \fB\-V\fR, \fB\-\-version\fR .RS 4 Print the pg_isready version and exit\&. .RE .PP \fB\-?\fR, \fB\-\-help\fR .RS 4 Show help about pg_isready command line arguments, and exit\&. .RE .SH "EXIT STATUS" .PP pg_isready returns 0 to the shell if the server is accepting connections normally, 1 if the server is rejecting connections (for example during startup), 2 if there was no response to the connection attempt, and 3 if no attempt was made (for example due to invalid parameters)\&. .SH "ENVIRONMENT" .PP \fBpg_isready\fR, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 31.14, \(lqEnvironment Variables\(rq, in the documentation)\&. .SH "NOTES" .PP The options \fB\-\-dbname\fR and \fB\-\-username\fR can be used to avoid gratuitous error messages in the logs, but are not necessary for proper functionality\&. .SH "EXAMPLES" .PP Standard Usage: .sp .if n \{\ .RS 4 .\} .nf $ \fBpg_isready\fR /tmp:5432 \- accepting connections $ \fBecho $?\fR 0 .fi .if n \{\ .RE .\} .PP Running with connection parameters to a PostgreSQL cluster in startup: .sp .if n \{\ .RS 4 .\} .nf $ \fBpg_isready \-h localhost \-p 5433\fR localhost:5433 \- rejecting connections $ \fBecho $?\fR 1 .fi .if n \{\ .RE .\} .PP Running with connection parameters to a non\-responsive PostgreSQL cluster: .sp .if n \{\ .RS 4 .\} .nf $ \fBpg_isready \-h someremotehost\fR someremotehost:5432 \- no response $ \fBecho $?\fR 2 .fi .if n \{\ .RE .\} .sp