Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/pgarchivecleanup.sgml`
56af52a9d9afdd1e87f7d84f146a704bba6c560927b4b3f30000000100000d4d
 <varlistentry>
      <term><option>-d</option></term>
      <term><option>--debug</option></term>
      <listitem>
       <para>
        Print lots of debug logging output on <filename>stderr</filename>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-n</option></term>
      <term><option>--dry-run</option></term>
      <listitem>
       <para>
        Print the names of the files that would have been removed on <filename>stdout</filename> (performs a dry run).
       </para>
      </listitem>
     </varlistentry>

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

     <varlistentry>
      <term><option>-x <replaceable class="parameter">extension</replaceable></option></term>
      <term><option>--strip-extension=<replaceable class="parameter">extension</replaceable></option></term>
      <listitem>
       <para>
        Provide an extension
        that will be stripped from all file names before deciding if they
        should be deleted.  This is typically useful for cleaning up archives
        that have been compressed during storage, and therefore have had an
        extension added by the compression program.  For example: <literal>-x
        .gz</literal>.
       </para>

      </listitem>
     </varlistentry>

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

 <refsect1>
  <title>Environment</title>

  <para>
   The environment variable <envar>PG_COLOR</envar> specifies whether to use
   color in diagnostic messages. Possible values are
   <literal>always</literal>, <literal>auto</literal> and
   <literal>never</literal>.
  </para>
 </refsect1>

 <refsect1>
  <title>Notes</title>

  <para>
   <application>pg_archivecleanup</application> is designed to work with
   <productname>PostgreSQL</productname> 8.0 and later when used as a standalone utility,
   or with <productname>PostgreSQL</productname> 9.0 and later when used as an
   archive cleanup command.
  </para>

  <para>
   <application>pg_archivecleanup</application> is written in C and has an
   easy-to-modify source code, with specifically designated sections to modify
   for your own needs
  </para>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>On Linux or Unix systems, you might use:
<programlisting>
archive_cleanup_command = 'pg_archivecleanup -d /mnt/standby/archive %r 2>>cleanup.log'
</programlisting>
   where the archive directory is physically located on the standby server,
   so that the <varname>archive_command</varname> is accessing it across NFS,
   but the files are local to the standby.
   This will:
  </para>
  <itemizedlist>
   <listitem>
    <para>
     produce debugging output in <filename>cleanup.log</filename>
    </para>
   </listitem>
   <listitem>
    <para>
     remove no-longer-needed files from the archive directory
    </para>
   </listitem>
  </itemizedlist>
 </refsect1>

</refentry>

Title: pg_archivecleanup: Advanced Options, Environment, Notes, and Examples
Summary
This section covers the remaining command-line options for pg_archivecleanup, including stripping extensions from filenames and displaying help. It also describes the PG_COLOR environment variable for controlling color in diagnostic messages, notes compatibility with PostgreSQL versions, and provides a Linux/Unix example configuration for using pg_archivecleanup with a standby server across NFS, including debugging and file removal.