OmniPITR - omnipitr-backup-cleanup


/some/path/omnipitr/bin/omnipitr-backup-cleanup [options]


--archive (-a)

Where archived wal segments are kept.

Check "Storage dir specification" for more details.

--backup-dir (-b)

Location of backup directory.

Check "Storage dir specification" for more details.

--filename-template (-f)

Template for naming output files. Should be the same as was used for making the backup by omnipitr-backup-master or omnipitr-backup-slave.

Defaults to the same value that these scripts use, so if you didn't change it for making backups, you don't need to specify it in here.

--keep-days (-k)

How long to keep backups. Defaults to 7 days.

--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'
--verbose (-v)

Log verbosely what is happening.

--version (-V)

Prints version of omnipitr-backup-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.


--archive /mnt/wal_archive
--backup-dir /mnt/backups
--log /tmp/log

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-backup-cleanup should (generally) be in some kind of scheduler - like crontab.

Set of options that you prefer depends on your situation, but at the very least you need three options:

  • --backup-dir= - where are your backups. Please note that you have to have backups made with OmniPITR v.1.3.0 at least, as previous versions didn't have "meta" files.

  • --archive-dir= - where are xlog files. These should be xlogs generated by the same system that the backups are for.

  • --log= - where to store logs about removal. You can use "-" as log value, it will redirect logs to stdout.

Storage dir specification

Directory is, in simplest situation, just a path. Usually, though, you will have some kind of compression on one or both of the directories (backups, archives).

In case of compression, you use the same syntax in every other omnipitr-* program - that is you prefix path with compression type and "=" sign.

Allowed compression types:

  • gzip

    Used file extension is .gz

  • bzip2

    Used file extension is .bz2

  • lzma

    Used file extension is .lzma


Minimal setup:

/path/to/omnipitr-backup-cleanup -a /mnt/wal_archive -b /mnt/backups -l -

Compressed archive and backup dir, non default number of days to keep backups, and store logs

/path/to/omnipitr-backup-cleanup -a gzip=/mnt/wal_archive -b gzip=/mnt/backups -l /var/log/omnipitr-backup-cleanup.log -v -k 3

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