files:
<programlisting>
archive_command = 'gzip < %p > /mnt/server/archivedir/%f.gz'
</programlisting>
You will then need to use <application>gunzip</application> during recovery:
<programlisting>
restore_command = 'gunzip < /mnt/server/archivedir/%f.gz > %p'
</programlisting>
</para>
</sect3>
<sect3 id="backup-scripts">
<title><varname>archive_command</varname> Scripts</title>
<para>
Many people choose to use scripts to define their
<varname>archive_command</varname>, so that their
<filename>postgresql.conf</filename> entry looks very simple:
<programlisting>
archive_command = 'local_backup_script.sh "%p" "%f"'
</programlisting>
Using a separate script file is advisable any time you want to use
more than a single command in the archiving process.
This allows all complexity to be managed within the script, which
can be written in a popular scripting language such as
<application>bash</application> or <application>perl</application>.
</para>
<para>
Examples of requirements that might be solved within a script include:
<itemizedlist>
<listitem>
<para>
Copying data to secure off-site data storage
</para>
</listitem>
<listitem>
<para>
Batching WAL files so that they are transferred every three hours,
rather than one at a time
</para>
</listitem>
<listitem>
<para>
Interfacing with other backup and recovery software
</para>
</listitem>
<listitem>
<para>
Interfacing with monitoring software to report errors
</para>
</listitem>
</itemizedlist>
</para>
<tip>
<para>
When using an <varname>archive_command</varname> script, it's desirable
to enable <xref linkend="guc-logging-collector"/>.
Any messages written to <systemitem>stderr</systemitem> from the script will then
appear in the database server log, allowing complex configurations to
be diagnosed easily if they fail.
</para>
</tip>
</sect3>
</sect2>
<sect2 id="continuous-archiving-caveats">
<title>Caveats</title>
<para>
At this writing, there are several limitations of the continuous archiving
technique. These will probably be fixed in future releases:
<itemizedlist>
<listitem>
<para>