Home Explore Blog CI



postgresql

6th chunk of `doc/src/sgml/ref/pg_ctl-ref.sgml`
6c1aa4c251c1ad09852e2088f51174b8f35ab814d1eac8440000000100000fa7
 By default the <filename>postgres</filename> executable is taken from the same
        directory as <command>pg_ctl</command>, 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 <filename>postgres</filename> executable was not found.
       </para>

       <para>
        In <literal>init</literal> mode, this option analogously
        specifies the location of the <filename>initdb</filename>
        executable.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-s</option></term>
      <term><option>--silent</option></term>
      <listitem>
       <para>
        Print only errors, no informational messages.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-t <replaceable class="parameter">seconds</replaceable></option></term>
      <term><option>--timeout=<replaceable class="parameter">seconds</replaceable></option></term>
      <listitem>
       <para>
        Specifies the maximum number of seconds to wait when waiting for an
        operation to complete (see option <option>-w</option>).  Defaults to
        the value of the <envar>PGCTLTIMEOUT</envar> environment variable or, if
        not set, to 60 seconds.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-V</option></term>
      <term><option>--version</option></term>
       <listitem>
        <para>
         Print the <application>pg_ctl</application> version and exit.
        </para>
       </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-w</option></term>
      <term><option>--wait</option></term>
      <listitem>
       <para>
        Wait for the operation to complete.  This is supported for the
        modes <literal>start</literal>, <literal>stop</literal>,
        <literal>restart</literal>, <literal>promote</literal>,
        and <literal>register</literal>, and is the default for those modes.
       </para>

       <para>
        When waiting, <command>pg_ctl</command> repeatedly checks the
        server's <acronym>PID</acronym> file, sleeping for a short amount
        of time between checks.  Startup is considered complete when
        the <acronym>PID</acronym> file indicates that the server is ready to
        accept connections.  Shutdown is considered complete when the server
        removes the <acronym>PID</acronym> file.
        <command>pg_ctl</command> returns an exit code based on the
        success of the startup or shutdown.
       </para>

       <para>
        If the operation does not complete within the timeout (see
        option <option>-t</option>), then <command>pg_ctl</command> exits with
        a nonzero exit status.  But note that the operation might continue in
        the background and eventually succeed.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-W</option></term>
      <term><option>--no-wait</option></term>
      <listitem>
       <para>
        Do not wait for the operation to complete.  This is the opposite of
        the option <option>-w</option>.
       </para>

       <para>
        If waiting is disabled, the requested action is triggered, but there
        is no feedback about its success.  In that case, the server log file
        or an external monitoring system would have to be used to check the
        progress and success of the operation.
       </para>

       <para>
        In prior releases of PostgreSQL, this was the default except for
        the <literal>stop</literal> mode.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-?</option></term>
      <term><option>--help</option></term>
      <listitem>
       <para>
        Show help about <application>pg_ctl</application> command line
        arguments, and exit.
       </para>

Title: pg_ctl Options: Timeout, Version, Wait, No-Wait, and Help
Summary
This section details the remaining options for `pg_ctl`. It covers `-t` for setting a timeout when waiting for an operation, `-V` to display the pg_ctl version, `-w` to wait for an operation to complete (default for start, stop, restart, promote, and register modes), `-W` to disable waiting for an operation, and `-?` to display help information.