Server IP : 103.119.228.120 / Your IP : 3.144.235.138 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/share/doc/postgresql-9.2.24/html/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >pg_ctl</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.2.24 Documentation" HREF="index.html"><LINK REL="UP" TITLE="PostgreSQL Server Applications" HREF="reference-server.html"><LINK REL="PREVIOUS" TITLE="pg_controldata" HREF="app-pgcontroldata.html"><LINK REL="NEXT" TITLE="pg_resetxlog" HREF="app-pgresetxlog.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2017-11-06T22:43:11"></HEAD ><BODY CLASS="REFENTRY" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.2.24 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="pg_controldata" HREF="app-pgcontroldata.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="reference-server.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="pg_resetxlog" HREF="app-pgresetxlog.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="APP-PG-CTL" ></A ><SPAN CLASS="APPLICATION" >pg_ctl</SPAN ></H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN86938" ></A ><H2 >Name</H2 >pg_ctl -- initialize, start, stop, or control a <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > server</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN86944" ></A ><H2 >Synopsis</H2 ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >init[db]</TT > [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >] [<TT CLASS="OPTION" >-o</TT > <TT CLASS="REPLACEABLE" ><I >initdb-options</I ></TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >start</TT > [<TT CLASS="OPTION" >-w</TT >] [<TT CLASS="OPTION" >-t</TT > <TT CLASS="REPLACEABLE" ><I >seconds</I ></TT >] [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >] [<TT CLASS="OPTION" >-l</TT > <TT CLASS="REPLACEABLE" ><I >filename</I ></TT >] [<TT CLASS="OPTION" >-o</TT > <TT CLASS="REPLACEABLE" ><I >options</I ></TT >] [<TT CLASS="OPTION" >-p</TT > <TT CLASS="REPLACEABLE" ><I >path</I ></TT >] [<TT CLASS="OPTION" >-c</TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >stop</TT > [<TT CLASS="OPTION" >-W</TT >] [<TT CLASS="OPTION" >-t</TT > <TT CLASS="REPLACEABLE" ><I >seconds</I ></TT >] [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >] [<TT CLASS="OPTION" >-m</TT > <TT CLASS="OPTION" >s[mart]</TT > | <TT CLASS="OPTION" >f[ast]</TT > | <TT CLASS="OPTION" >i[mmediate]</TT > ]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >restart</TT > [<TT CLASS="OPTION" >-w</TT >] [<TT CLASS="OPTION" >-t</TT > <TT CLASS="REPLACEABLE" ><I >seconds</I ></TT >] [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >] [<TT CLASS="OPTION" >-c</TT >] [<TT CLASS="OPTION" >-m</TT > <TT CLASS="OPTION" >s[mart]</TT > | <TT CLASS="OPTION" >f[ast]</TT > | <TT CLASS="OPTION" >i[mmediate]</TT > ] [<TT CLASS="OPTION" >-o</TT > <TT CLASS="REPLACEABLE" ><I >options</I ></TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >reload</TT > [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >status</TT > [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >promote</TT > [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >kill</TT > <TT CLASS="REPLACEABLE" ><I >signal_name</I ></TT > <TT CLASS="REPLACEABLE" ><I >process_id</I ></TT > </P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >register</TT > [<TT CLASS="OPTION" >-N</TT > <TT CLASS="REPLACEABLE" ><I >servicename</I ></TT >] [<TT CLASS="OPTION" >-U</TT > <TT CLASS="REPLACEABLE" ><I >username</I ></TT >] [<TT CLASS="OPTION" >-P</TT > <TT CLASS="REPLACEABLE" ><I >password</I ></TT >] [<TT CLASS="OPTION" >-D</TT > <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT >] [<TT CLASS="OPTION" >-S</TT > <TT CLASS="OPTION" >a[uto]</TT > | <TT CLASS="OPTION" >d[emand]</TT > ] [<TT CLASS="OPTION" >-w</TT >] [<TT CLASS="OPTION" >-t</TT > <TT CLASS="REPLACEABLE" ><I >seconds</I ></TT >] [<TT CLASS="OPTION" >-s</TT >] [<TT CLASS="OPTION" >-o</TT > <TT CLASS="REPLACEABLE" ><I >options</I ></TT >]</P ><P ><TT CLASS="COMMAND" >pg_ctl</TT > <TT CLASS="OPTION" >unregister</TT > [<TT CLASS="OPTION" >-N</TT > <TT CLASS="REPLACEABLE" ><I >servicename</I ></TT >]</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="APP-PG-CTL-DESCRIPTION" ></A ><H2 >Description</H2 ><P > <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > is a utility for initializing a <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > database cluster, starting, stopping, or restarting the <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > database server (<A HREF="app-postgres.html" ><SPAN CLASS="APPLICATION" >postgres</SPAN ></A >), or displaying the status of a running server. Although the server can be started manually, <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > encapsulates tasks such as redirecting log output and properly detaching from the terminal and process group. It also provides convenient options for controlled shutdown. </P ><P > The <TT CLASS="OPTION" >init</TT > or <TT CLASS="OPTION" >initdb</TT > mode creates a new <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > database cluster. A database cluster is a collection of databases that are managed by a single server instance. This mode invokes the <TT CLASS="COMMAND" >initdb</TT > command. See <A HREF="app-initdb.html" >initdb</A > for details. </P ><P > In <TT CLASS="OPTION" >start</TT > mode, a new server is launched. The server is started in the background, and its standard input is attached to <TT CLASS="FILENAME" >/dev/null</TT > (or <TT CLASS="LITERAL" >nul</TT > on Windows). On Unix-like systems, by default, the server's standard output and standard error are sent to <SPAN CLASS="APPLICATION" >pg_ctl</SPAN >'s standard output (not standard error). The standard output of <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > should then be redirected to a file or piped to another process such as a log rotating program like <SPAN CLASS="APPLICATION" >rotatelogs</SPAN >; otherwise <TT CLASS="COMMAND" >postgres</TT > will write its output to the controlling terminal (from the background) and will not leave the shell's process group. On Windows, by default the server's standard output and standard error are sent to the terminal. These default behaviors can be changed by using <TT CLASS="OPTION" >-l</TT > to append the server's output to a log file. Use of either <TT CLASS="OPTION" >-l</TT > or output redirection is recommended. </P ><P > In <TT CLASS="OPTION" >stop</TT > mode, the server that is running in the specified data directory is shut down. Three different shutdown methods can be selected with the <TT CLASS="OPTION" >-m</TT > option. <SPAN CLASS="QUOTE" >"Smart"</SPAN > mode (the default) waits for all active clients to disconnect and any online backup to finish. If the server is in hot standby, recovery and streaming replication will be terminated once all clients have disconnected. <SPAN CLASS="QUOTE" >"Fast"</SPAN > mode does not wait for clients to disconnect and will terminate an online backup in progress. All active transactions are rolled back and clients are forcibly disconnected, then the server is shut down. <SPAN CLASS="QUOTE" >"Immediate"</SPAN > mode will abort all server processes immediately, without a clean shutdown. This will lead to a crash-recovery run on the next restart. </P ><P > <TT CLASS="OPTION" >restart</TT > mode effectively executes a stop followed by a start. This allows changing the <TT CLASS="COMMAND" >postgres</TT > command-line options. </P ><P > <TT CLASS="OPTION" >reload</TT > mode simply sends the <TT CLASS="COMMAND" >postgres</TT > process a <SPAN CLASS="SYSTEMITEM" >SIGHUP</SPAN > signal, causing it to reread its configuration files (<TT CLASS="FILENAME" >postgresql.conf</TT >, <TT CLASS="FILENAME" >pg_hba.conf</TT >, etc.). This allows changing of configuration-file options that do not require a complete restart to take effect. </P ><P > <TT CLASS="OPTION" >status</TT > mode checks whether a server is running in the specified data directory. If it is, the <ACRONYM CLASS="ACRONYM" >PID</ACRONYM > and the command line options that were used to invoke it are displayed. If the server is not running, the process returns an exit status of 3. </P ><P > In <TT CLASS="OPTION" >promote</TT > mode, the standby server that is running in the specified data directory is commanded to exit recovery and begin read-write operations. </P ><P > <TT CLASS="OPTION" >kill</TT > mode allows you to send a signal to a specified process. This is particularly valuable for <SPAN CLASS="PRODUCTNAME" >Microsoft Windows</SPAN > which does not have a <SPAN CLASS="APPLICATION" >kill</SPAN > command. Use <TT CLASS="LITERAL" >--help</TT > to see a list of supported signal names. </P ><P > <TT CLASS="OPTION" >register</TT > mode allows you to register a system service on <SPAN CLASS="PRODUCTNAME" >Microsoft Windows</SPAN >. The <TT CLASS="OPTION" >-S</TT > option allows selection of service start type, either <SPAN CLASS="QUOTE" >"auto"</SPAN > (start service automatically on system startup) or <SPAN CLASS="QUOTE" >"demand"</SPAN > (start service on demand). </P ><P > <TT CLASS="OPTION" >unregister</TT > mode allows you to unregister a system service on <SPAN CLASS="PRODUCTNAME" >Microsoft Windows</SPAN >. This undoes the effects of the <TT CLASS="OPTION" >register</TT > command. </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="APP-PG-CTL-OPTIONS" ></A ><H2 >Options</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="OPTION" >-c</TT ><BR><TT CLASS="OPTION" >--core-file</TT ></DT ><DD ><P > Attempt to allow server crashes to produce core files, on platforms where this is possible, by lifting any soft resource limit placed on core files. This is useful in debugging or diagnosing problems by allowing a stack trace to be obtained from a failed server process. </P ></DD ><DT ><TT CLASS="OPTION" >-D <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT ></TT ><BR><TT CLASS="OPTION" >--pgdata <TT CLASS="REPLACEABLE" ><I >datadir</I ></TT ></TT ></DT ><DD ><P > Specifies the file system location of the database files. If this is omitted, the environment variable <TT CLASS="ENVAR" >PGDATA</TT > is used. </P ></DD ><DT ><TT CLASS="OPTION" >-l <TT CLASS="REPLACEABLE" ><I >filename</I ></TT ></TT ><BR><TT CLASS="OPTION" >--log <TT CLASS="REPLACEABLE" ><I >filename</I ></TT ></TT ></DT ><DD ><P > Append the server log output to <TT CLASS="REPLACEABLE" ><I >filename</I ></TT >. If the file does not exist, it is created. The <SPAN CLASS="SYSTEMITEM" >umask</SPAN > is set to 077, so access to the log file is disallowed to other users by default. </P ></DD ><DT ><TT CLASS="OPTION" >-m <TT CLASS="REPLACEABLE" ><I >mode</I ></TT ></TT ><BR><TT CLASS="OPTION" >--mode <TT CLASS="REPLACEABLE" ><I >mode</I ></TT ></TT ></DT ><DD ><P > Specifies the shutdown mode. <TT CLASS="REPLACEABLE" ><I >mode</I ></TT > can be <TT CLASS="LITERAL" >smart</TT >, <TT CLASS="LITERAL" >fast</TT >, or <TT CLASS="LITERAL" >immediate</TT >, or the first letter of one of these three. If this is omitted, <TT CLASS="LITERAL" >smart</TT > is used. </P ></DD ><DT ><TT CLASS="OPTION" >-o <TT CLASS="REPLACEABLE" ><I >options</I ></TT ></TT ></DT ><DD ><P > Specifies options to be passed directly to the <TT CLASS="COMMAND" >postgres</TT > command. </P ><P > The options should usually be surrounded by single or double quotes to ensure that they are passed through as a group. </P ></DD ><DT ><TT CLASS="OPTION" >-o <TT CLASS="REPLACEABLE" ><I >initdb-options</I ></TT ></TT ></DT ><DD ><P > Specifies options to be passed directly to the <TT CLASS="COMMAND" >initdb</TT > command. </P ><P > The options should usually be surrounded by single or double quotes to ensure that they are passed through as a group. </P ></DD ><DT ><TT CLASS="OPTION" >-p <TT CLASS="REPLACEABLE" ><I >path</I ></TT ></TT ></DT ><DD ><P > Specifies the location of the <TT CLASS="FILENAME" >postgres</TT > executable. By default the <TT CLASS="FILENAME" >postgres</TT > executable is taken from the same directory as <TT CLASS="COMMAND" >pg_ctl</TT >, or failing that, the hard-wired installation directory. It is not necessary to use this option unless you are doing something unusual and get errors that the <TT CLASS="FILENAME" >postgres</TT > executable was not found. </P ><P > In <TT CLASS="LITERAL" >init</TT > mode, this option analogously specifies the location of the <TT CLASS="FILENAME" >initdb</TT > executable. </P ></DD ><DT ><TT CLASS="OPTION" >-s</TT ><BR><TT CLASS="OPTION" >--silent</TT ></DT ><DD ><P > Print only errors, no informational messages. </P ></DD ><DT ><TT CLASS="OPTION" >-t</TT ><BR><TT CLASS="OPTION" >--timeout</TT ></DT ><DD ><P > The maximum number of seconds to wait when waiting for startup or shutdown to complete. Defaults to the value of the <TT CLASS="ENVAR" >PGCTLTIMEOUT</TT > environment variable or, if not set, to 60 seconds. </P ></DD ><DT ><TT CLASS="OPTION" >-V</TT ><BR><TT CLASS="OPTION" >--version</TT ></DT ><DD ><P > Print the <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > version and exit. </P ></DD ><DT ><TT CLASS="OPTION" >-w</TT ></DT ><DD ><P > Wait for the startup or shutdown to complete. Waiting is the default option for shutdowns, but not startups. When waiting for startup, <TT CLASS="COMMAND" >pg_ctl</TT > repeatedly attempts to connect to the server. When waiting for shutdown, <TT CLASS="COMMAND" >pg_ctl</TT > waits for the server to remove its <ACRONYM CLASS="ACRONYM" >PID</ACRONYM > file. <TT CLASS="COMMAND" >pg_ctl</TT > returns an exit code based on the success of the startup or shutdown. </P ></DD ><DT ><TT CLASS="OPTION" >-W</TT ></DT ><DD ><P > Do not wait for startup or shutdown to complete. This is the default for start and restart modes. </P ></DD ><DT ><TT CLASS="OPTION" >-?</TT ><BR><TT CLASS="OPTION" >--help</TT ></DT ><DD ><P > Show help about <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > command line arguments, and exit. </P ></DD ></DL ></DIV ><DIV CLASS="REFSECT2" ><A NAME="APP-PG-CTL-WINDOWS-OPTIONS" ></A ><H3 >Options for Windows</H3 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="OPTION" >-N <TT CLASS="REPLACEABLE" ><I >servicename</I ></TT ></TT ></DT ><DD ><P > Name of the system service to register. The name will be used as both the service name and the display name. </P ></DD ><DT ><TT CLASS="OPTION" >-P <TT CLASS="REPLACEABLE" ><I >password</I ></TT ></TT ></DT ><DD ><P > Password for the user to start the service. </P ></DD ><DT ><TT CLASS="OPTION" >-S <TT CLASS="REPLACEABLE" ><I >start-type</I ></TT ></TT ></DT ><DD ><P > Start type of the system service to register. start-type can be <TT CLASS="LITERAL" >auto</TT >, or <TT CLASS="LITERAL" >demand</TT >, or the first letter of one of these two. If this is omitted, <TT CLASS="LITERAL" >auto</TT > is used. </P ></DD ><DT ><TT CLASS="OPTION" >-U <TT CLASS="REPLACEABLE" ><I >username</I ></TT ></TT ></DT ><DD ><P > User name for the user to start the service. For domain users, use the format <TT CLASS="LITERAL" >DOMAIN\username</TT >. </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN87315" ></A ><H2 >Environment</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="ENVAR" >PGCTLTIMEOUT</TT ></DT ><DD ><P > Default limit on the number of seconds to wait when waiting for startup or shutdown to complete. If not set, the default is 60 seconds. </P ></DD ><DT ><TT CLASS="ENVAR" >PGDATA</TT ></DT ><DD ><P > Default data directory location. </P ></DD ></DL ></DIV ><P > <TT CLASS="COMMAND" >pg_ctl</TT >, like most other <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > utilities, also uses the environment variables supported by <SPAN CLASS="APPLICATION" >libpq</SPAN > (see <A HREF="libpq-envars.html" >Section 31.14</A >). For additional server variables, see <A HREF="app-postgres.html" ><SPAN CLASS="APPLICATION" >postgres</SPAN ></A >. </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN87334" ></A ><H2 >Files</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="FILENAME" >postmaster.pid</TT ></DT ><DD ><P > The existence of this file in the data directory is used to help <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > determine if the server is currently running. </P ></DD ><DT ><TT CLASS="FILENAME" >postmaster.opts</TT ></DT ><DD ><P >If this file exists in the data directory, <SPAN CLASS="APPLICATION" >pg_ctl</SPAN > (in <TT CLASS="OPTION" >restart</TT > mode) will pass the contents of the file as options to <SPAN CLASS="APPLICATION" >postgres</SPAN >, unless overridden by the <TT CLASS="OPTION" >-o</TT > option. The contents of this file are also displayed in <TT CLASS="OPTION" >status</TT > mode. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="R1-APP-PGCTL-2" ></A ><H2 >Examples</H2 ><DIV CLASS="REFSECT2" ><A NAME="R2-APP-PGCTL-3" ></A ><H3 >Starting the Server</H3 ><P > To start the server: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl start</KBD ></PRE ><P> </P ><P > To start the server, waiting until the server is accepting connections: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl -w start</KBD ></PRE ><P> </P ><P > To start the server using port 5433, and running without <CODE CLASS="FUNCTION" >fsync</CODE >, use: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl -o "-F -p 5433" start</KBD ></PRE ><P></P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="R2-APP-PGCTL-4" ></A ><H3 >Stopping the Server</H3 ><P > To stop the server, use: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl stop</KBD ></PRE ><P> The <TT CLASS="OPTION" >-m</TT > option allows control over <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >how</I ></SPAN > the server shuts down: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl stop -m fast</KBD ></PRE ><P></P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="R2-APP-PGCTL-5" ></A ><H3 >Restarting the Server</H3 ><P > Restarting the server is almost equivalent to stopping the server and starting it again, except that <TT CLASS="COMMAND" >pg_ctl</TT > saves and reuses the command line options that were passed to the previously running instance. To restart the server in the simplest form, use: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl restart</KBD ></PRE ><P> </P ><P > To restart the server, waiting for it to shut down and restart: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl -w restart</KBD ></PRE ><P> </P ><P > To restart using port 5433, disabling <CODE CLASS="FUNCTION" >fsync</CODE > upon restart: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl -o "-F -p 5433" restart</KBD ></PRE ><P></P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="R2-APP-PGCTL-6" ></A ><H3 >Showing the Server Status</H3 ><P > Here is sample status output from <SPAN CLASS="APPLICATION" >pg_ctl</SPAN >: </P><PRE CLASS="SCREEN" ><SAMP CLASS="PROMPT" >$</SAMP > <KBD CLASS="USERINPUT" >pg_ctl status</KBD > <SAMP CLASS="COMPUTEROUTPUT" >pg_ctl: server is running (PID: 13718) /usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" "-p" "5433" "-B" "128"</SAMP ></PRE ><P> This is the command line that would be invoked in restart mode. </P ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN87405" ></A ><H2 >See Also</H2 ><A HREF="app-initdb.html" >initdb</A >, <A HREF="app-postgres.html" ><SPAN CLASS="APPLICATION" >postgres</SPAN ></A ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="app-pgcontroldata.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="app-pgresetxlog.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><SPAN CLASS="APPLICATION" >pg_controldata</SPAN ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="reference-server.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><SPAN CLASS="APPLICATION" >pg_resetxlog</SPAN ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >