{"Entry":{"collection":"tool","key":"pg-isready","name":"pg_isready","aliases":["pg_isready"],"metadata":{"aliases":["pg_isready"],"category":"Client applications","content_hash":"bdfdb5489c48c924f8d75f9134db561d2dd06e910602607c57aafeee19e11dfa","derived_content_hash":"2369ed3055e44f5b7d78c61e177d4c178ac5d3f6b0d131b885f6cba849f52d9d","imported_at":"2026-09-30T00:40:34.29983+08:00","name":"pg_isready","name_zh":"","slug":"pg-isready","summary":"pg_isready — check the connection status of a PostgreSQL server"}},"Definition":{"Collection":"tool","Key":"pg-isready","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"pg-isready","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[],"options":[{"description":"Specifies the name of the database to connect to. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname"},{"description":"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.","names":["-h hostname","--host= hostname"],"signature":"-h hostname --host= hostname"},{"description":"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 PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"Do not display status message. This is useful when scripting.","names":["-q","--quiet"],"signature":"-q --quiet"},{"description":"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.","names":["-t seconds","--timeout= seconds"],"signature":"-t seconds --timeout= seconds"},{"description":"Connect to the database as the user username instead of the default.","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Print the pg_isready version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Show help about pg_isready command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"}],"synopsis":["pg_isready [ connection-option ...] [ option ...]"]},"comparison_hash":"8525c44d4a3f398e1aee9846a2dc02320c2b9e94d11f3ae9c90992fcbb0c5455","description":["pg_isready — check the connection status of a PostgreSQL server"],"description_zh":"描述 pg_isready 是一个用于检查 PostgreSQL 数据库服务器连接状态的工具。其退出状态指示连接检查的结果。 选项 -d dbname --dbname= dbname 指定要连接的数据库名称。 dbname 也可以是 连接字符串 。如果是这样，连接字符串中的参数将覆盖任何冲突的命令行选项。 -h hostname --host= hostname 指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。 -p port --port= port 指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 PGPORT 环境变量；如果未设置，则取编译时指定的端口，通常为 5432。 -q --quiet 不显示状态消息。这在编写脚本时很有用。 -t seconds --timeout= seconds 在尝试连接时，返回服务器无响应之前等待的最大秒数。设为 0 表示禁用。默认值为 3 秒。 -U username --username= username 以用户 username 连接到数据库，而不是使用默认用户。 -V --version 打印 pg_isready 版本并退出。 -? --help 显示有关 pg_isready 命令行参数的帮助并退出。","description_zh_html":"\u003cp\u003e命令行工具 pg_isready [ connection-option ...] [ option ...]。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e 是一个用于检查\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库服务器连接状态的工具。其退出状态指示连接检查的结果。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定要连接的数据库名称。\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 也可以是\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\"\u003e连接字符串\u003c/a\u003e。如果是这样，连接字符串中的参数将覆盖任何冲突的命令行选项。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量；如果未设置，则取编译时指定的端口，通常为 5432。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不显示状态消息。这在编写脚本时很有用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在尝试连接时，返回服务器无响应之前等待的最大秒数。设为 0 表示禁用。默认值为 3 秒。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       以用户 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e 连接到数据库，而不是使用默认用户。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         打印 \u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e 版本并退出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示有关 \u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e 命令行参数的帮助并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/app-pg-isready.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","environment":[],"facts":[{"label":"Documented executable","value":"pg_isready"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"8"}],"facts_zh":[{"label":"手册中的可执行程序","value":"pg_isready"},{"label":"程序版本","value":"18.6"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"8"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PG-ISREADY\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_isready — check the connection status of a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.16.4.1\"\u003e\u003ccode class=\"command\"\u003epg_isready\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e is a utility for checking the connection status of a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database server. The exit status specifies the result of the connection check.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable or, if not set, to the port specified at compile time, usually 5432.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display status message. This is useful when scripting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eConnect to the database as the user \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e instead of the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.16.7\"\u003e\n\u003ch2\u003eExit Status\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e returns \u003ccode class=\"literal\"\u003e0\u003c/code\u003e to the shell if the server is accepting connections normally, \u003ccode class=\"literal\"\u003e1\u003c/code\u003e if the server is rejecting connections (for example during startup), \u003ccode class=\"literal\"\u003e2\u003c/code\u003e if there was no response to the connection attempt, and \u003ccode class=\"literal\"\u003e3\u003c/code\u003e if no attempt was made (for example due to invalid parameters).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.16.8\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epg_isready\u003c/code\u003e, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe environment variable \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e specifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-NOTES\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eIt 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.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eStandard Usage:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_isready\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e/tmp:5432 - accepting connections\u003c/code\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e0\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eRunning with connection parameters to a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e cluster in startup:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_isready -h localhost -p 5433\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003elocalhost:5433 - rejecting connections\u003c/code\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e1\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eRunning with connection parameters to a non-responsive \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e cluster:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_isready -h someremotehost\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003esomeremotehost:5432 - no response\u003c/code\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e2\u003c/code\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-pg-isready.html","options":[{"description":"Specifies the name of the database to connect to. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname","source_url":"/docs/18/app-pg-isready.html","summary":"Specifies the name of the database to connect to. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"description":"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.","names":["-h hostname","--host= hostname"],"signature":"-h hostname --host= hostname","source_url":"/docs/18/app-pg-isready.html","summary":"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."},{"description":"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 PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-pg-isready.html","summary":"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 PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."},{"description":"Do not display status message. This is useful when scripting.","names":["-q","--quiet"],"signature":"-q --quiet","source_url":"/docs/18/app-pg-isready.html","summary":"Do not display status message. This is useful when scripting."},{"description":"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.","names":["-t seconds","--timeout= seconds"],"signature":"-t seconds --timeout= seconds","source_url":"/docs/18/app-pg-isready.html","summary":"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."},{"description":"Connect to the database as the user username instead of the default.","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-pg-isready.html","summary":"Connect to the database as the user username instead of the default."},{"description":"Print the pg_isready version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-pg-isready.html","summary":"Print the pg_isready version and exit."},{"description":"Show help about pg_isready command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-pg-isready.html","summary":"Show help about pg_isready command line arguments, and exit."}],"related":[],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"sections_zh":[],"signature":"pg_isready [ connection-option ...] [ option ...]","sources":[{"anchor":"","file":"app-pg-isready.html","label":"18.6 English manual · app-pg-isready.html","sha256":"6e6424b4abc97251d901e24fef966ddfb326156d4ae8b6e2425829ee088909c8","url":"/docs/18/app-pg-isready.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["pg_isready [ connection-option ...] [ option ...]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pg-isready.html"},"summary":"Specifies the name of the database to connect to. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-h hostname --host= hostname","url":"/docs/18/app-pg-isready.html"},"summary":"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."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pg-isready.html"},"summary":"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 PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-pg-isready.html"},"summary":"Do not display status message. This is useful when scripting."},{"signature":{"text":"-t seconds --timeout= seconds","url":"/docs/18/app-pg-isready.html"},"summary":"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."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pg-isready.html"},"summary":"Connect to the database as the user username instead of the default."},{"signature":{"text":"-V --version","url":"/docs/18/app-pg-isready.html"},"summary":"Print the pg_isready version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-pg-isready.html"},"summary":"Show help about pg_isready command line arguments, and exit."}],"title":"Documented options"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pg-isready.html"},"summary":"指定要连接的数据库名称。 dbname 也可以是 连接字符串 。如果是这样，连接字符串中的参数将覆盖任何冲突的命令行选项。"},{"signature":{"text":"-h hostname --host= hostname","url":"/docs/18/app-pg-isready.html"},"summary":"指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pg-isready.html"},"summary":"指定服务器监听连接的 TCP 端口，或本地 Unix 域套接字的文件名后缀。默认使用 PGPORT 环境变量的值；未设置时，使用编译时指定的端口，通常为 5432。"},{"signature":{"text":"-q --quiet","url":"/docs/18/app-pg-isready.html"},"summary":"不显示状态消息。这在编写脚本时很有用。"},{"signature":{"text":"-t seconds --timeout= seconds","url":"/docs/18/app-pg-isready.html"},"summary":"在尝试连接时，返回服务器无响应之前等待的最大秒数。设为 0 表示禁用。默认值为 3 秒。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pg-isready.html"},"summary":"以用户 username 连接到数据库，而不是使用默认用户。"},{"signature":{"text":"-V --version","url":"/docs/18/app-pg-isready.html"},"summary":"打印 pg_isready 版本并退出。"},{"signature":{"text":"-? --help","url":"/docs/18/app-pg-isready.html"},"summary":"显示有关 pg_isready 命令行参数的帮助并退出。"}],"title":"手册中的选项"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"7f690753b5051db2c72a400d5ea043e202685d19b85c4b5151dd9a46fdaa5ff9","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"command-description-and-options","fragment_sha256":"540a96e9606971c721cfc13df5963ebc17d5a3f3bcae5762b0d460e66252b4fc","locale":"zh-Hans","page_key":"app-pg-isready.html","source_hash":"2398f129698164611e214e0572a2dd3e2ed2303f52a3b5a18c88c8e8d9119717","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/app-pg-isready.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8"}},"ManualEvidence":{"manual_path":"app-pg-isready.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-pg-isready.html","label":"18.6 English manual · app-pg-isready.html","sha256":"6e6424b4abc97251d901e24fef966ddfb326156d4ae8b6e2425829ee088909c8","url":"/docs/18/app-pg-isready.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"pg-isready","SourceDatabase":"center","Version":"18","Locale":"en","Title":"pg_isready","Summary":"pg_isready — check the connection status of a PostgreSQL server","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-PG-ISREADY\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epg_isready\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_isready — check the connection status of a \u003cspan\u003ePostgreSQL\u003c/span\u003e server\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.16.4.1\"\u003e\u003ccode\u003epg_isready\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PG-ISREADY-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_isready\u003c/span\u003e is a utility for checking the connection status of a \u003cspan\u003ePostgreSQL\u003c/span\u003e database server. The exit status specifies the result of the connection check.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PG-ISREADY-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--dbname=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to. The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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 \u003ccode\u003ePGPORT\u003c/code\u003e environment variable or, if not set, to the port specified at compile time, usually 5432.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display status message. This is useful when scripting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t \u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--timeout=\u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eConnect to the database as the user \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e instead of the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003epg_isready\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003epg_isready\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.16.7\"\u003e\n\u003ch2\u003eExit Status\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_isready\u003c/span\u003e returns \u003ccode\u003e0\u003c/code\u003e to the shell if the server is accepting connections normally, \u003ccode\u003e1\u003c/code\u003e if the server is rejecting connections (for example during startup), \u003ccode\u003e2\u003c/code\u003e if there was no response to the connection attempt, and \u003ccode\u003e3\u003c/code\u003e if no attempt was made (for example due to invalid parameters).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.16.8\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003epg_isready\u003c/code\u003e, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe environment variable \u003ccode\u003ePG_COLOR\u003c/code\u003e specifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PG-ISREADY-NOTES\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eIt 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.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PG-ISREADY-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eStandard Usage:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_isready\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003e/tmp:5432 - accepting connections\u003c/code\u003e\n\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003e0\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eRunning with connection parameters to a \u003cspan\u003ePostgreSQL\u003c/span\u003e cluster in startup:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003epg_isready -h localhost -p 5433\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003elocalhost:5433 - rejecting connections\u003c/code\u003e\n\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003e1\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eRunning with connection parameters to a non-responsive \u003cspan\u003ePostgreSQL\u003c/span\u003e cluster:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$ \u003c/code\u003e\u003cstrong\u003e\u003ccode\u003epg_isready -h someremotehost\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003esomeremotehost:5432 - no response\u003c/code\u003e\n\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode\u003e2\u003c/code\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"7f7fbb6f0789376c076b498d049276bc63c0ad9595a76498fdcd2e10f738e8f4","Payload":{"description":["pg_isready — check the connection status of a PostgreSQL server"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PG-ISREADY\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_isready — check the connection status of a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.16.4.1\"\u003e\u003ccode class=\"command\"\u003epg_isready\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e is a utility for checking the connection status of a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database server. The exit status specifies the result of the connection check.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable or, if not set, to the port specified at compile time, usually 5432.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not display status message. This is useful when scripting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eConnect to the database as the user \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e instead of the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.16.7\"\u003e\n\u003ch2\u003eExit Status\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_isready\u003c/span\u003e returns \u003ccode class=\"literal\"\u003e0\u003c/code\u003e to the shell if the server is accepting connections normally, \u003ccode class=\"literal\"\u003e1\u003c/code\u003e if the server is rejecting connections (for example during startup), \u003ccode class=\"literal\"\u003e2\u003c/code\u003e if there was no response to the connection attempt, and \u003ccode class=\"literal\"\u003e3\u003c/code\u003e if no attempt was made (for example due to invalid parameters).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.16.8\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epg_isready\u003c/code\u003e, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe environment variable \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e specifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-NOTES\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eIt 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.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-ISREADY-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eStandard Usage:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_isready\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e/tmp:5432 - accepting connections\u003c/code\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e0\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eRunning with connection parameters to a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e cluster in startup:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_isready -h localhost -p 5433\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003elocalhost:5433 - rejecting connections\u003c/code\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e1\u003c/code\u003e\n\u003c/pre\u003e\n\u003cp\u003eRunning with connection parameters to a non-responsive \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e cluster:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$ \u003c/code\u003e\u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_isready -h someremotehost\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003esomeremotehost:5432 - no response\u003c/code\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eecho $?\u003c/code\u003e\u003c/strong\u003e\n\u003ccode class=\"computeroutput\"\u003e2\u003c/code\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pg-isready.html"},"summary":"Specifies the name of the database to connect to. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-h hostname --host= hostname","url":"/docs/18/app-pg-isready.html"},"summary":"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."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pg-isready.html"},"summary":"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 PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-pg-isready.html"},"summary":"Do not display status message. This is useful when scripting."},{"signature":{"text":"-t seconds --timeout= seconds","url":"/docs/18/app-pg-isready.html"},"summary":"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."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pg-isready.html"},"summary":"Connect to the database as the user username instead of the default."},{"signature":{"text":"-V --version","url":"/docs/18/app-pg-isready.html"},"summary":"Print the pg_isready version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-pg-isready.html"},"summary":"Show help about pg_isready command line arguments, and exit."}],"title":"Documented options"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
