OmniPITR - omnipitr-cleanup


/some/path/omnipitr/bin/omnipitr-cleanup [options] %r


--archive (-a)

Where archived wal segments are kept.

Check "Archive specification" for more details.

--log (-l)

Name of logfile (actually template, as it supports %% strftime(3) markers. Unfortunately due to the %x usage by PostgreSQL, We cannot use %% macros directly. Instead - any occurence of ^ character in log dir will be first changed to %, and later on passed to strftime.

Please note that on some systems (Solaris for example) default shell treats ^ as special character, which requires you to quote the log filename (if it contains ^ character). So you'd better write it as:

--log '/var/log/omnipitr-^Y-^m-^d.log'

Name of file to use for pidfile. If it is specified, than only one copy of omnipitr-cleanup (with this pidfile) can run at the same time.

Trying to run second copy of omnipitr-cleanup will result in an error.

--verbose (-v)

Log verbosely what is happening.

--removal-pause-trigger (-p)

Path to file, which, if exists, causes omnipitr-cleanup to not do any removal - for example when running omnipitr-backup-slave.

--version (-V)

Prints version of omnipitr-cleanup, and exists.

--help (-?)

Prints this manual, and exists.

--config-file (--config / --cfg)

Loads options from config file.

Format of the file is very simple - each line is treated as argument with optional value.



It is important that you don't need to quote the values - value will always be up to the end of line (trailing spaces will be removed). So if you'd want, for example, to have magic-option set to "/mnt/badly named directory", you'd need to quote it when setting from command line:

/some/omnipitr/program --magic-option="/mnt/badly named directory"

but not in config:

--magic-option=/mnt/badly named directory

Empty lines, and comment lines (starting with #) are ignored.


Call to omnipitr-cleanup should be in archive_cleanup_command variable in recovery.conf.

Which options should be given depends only on installation, but generally you will need:

  • --archive

  • --log

And of course the %r at the end.

This script is used only in cases of streaming replication, as in case of wal-file based replication omnipitr-restore can remove obsolete wal files.

Archive specification

If the wal segments are compressed you have to prefix archive path with compression type followed by '=' sign.

Allowed compression types:

  • gzip

    Used file extension is .gz

  • bzip2

    Used file extension is .bz2

  • lzma

    Used file extension is .lzma

  • lz4

    Used file extension is .lz4

  • xz

    Used file extension is .xz


Minimal setup:

archive_cleanup_command='/.../omnipitr-cleanup -l /var/log/omnipitr/cleanup.log -a /mnt/wal_restore/ %r'

Minimal setup, for gzip-compressed archives:

archive_cleanup_command='/.../omnipitr-cleanup -l /var/log/omnipitr/cleanup.log -a gzip=/mnt/wal_restore/ %r'

The OmniPITR project is Copyright (c) 2009-2013 OmniTI. All rights reserved.