API documentation

This documentation is based on the source code of version 8.1 of the rotate-backups package. The following modules are available:

rotate_backups

Simple to use Python API for rotation of backups.

The rotate_backups module contains the Python API of the rotate-backups package. The core logic of the package is contained in the RotateBackups class.

rotate_backups.DEFAULT_REMOVAL_COMMAND = ['rm', '-fR']

The default removal command (a list of strings).

rotate_backups.ORDERED_FREQUENCIES = (('minutely', relativedelta(minutes=+1)), ('hourly', relativedelta(hours=+1)), ('daily', relativedelta(days=+1)), ('weekly', relativedelta(days=+7)), ('monthly', relativedelta(months=+1)), ('yearly', relativedelta(years=+1)))

An iterable of tuples with two values each:

  • The name of a rotation frequency (a string like ‘hourly’, ‘daily’, etc.).
  • A relativedelta object.

The tuples are sorted by increasing delta (intentionally).

rotate_backups.SUPPORTED_DATE_COMPONENTS = (('year', True), ('month', True), ('day', True), ('hour', False), ('minute', False), ('second', False))

An iterable of tuples with two values each:

  • The name of a date component (a string).
  • True for required components, False for optional components.
rotate_backups.SUPPORTED_FREQUENCIES = {'daily': relativedelta(days=+1), 'hourly': relativedelta(hours=+1), 'minutely': relativedelta(minutes=+1), 'monthly': relativedelta(months=+1), 'weekly': relativedelta(days=+7), 'yearly': relativedelta(years=+1)}

A dictionary with rotation frequency names (strings) as keys and relativedelta objects as values. This dictionary is generated based on the tuples in ORDERED_FREQUENCIES.

rotate_backups.TIMESTAMP_PATTERN = <_sre.SRE_Pattern object>

A compiled regular expression object used to match timestamps encoded in filenames.

rotate_backups.coerce_location(value, **options)[source]

Coerce a string to a Location object.

Parameters:
  • value – The value to coerce (a string or Location object).
  • options – Any keyword arguments are passed on to create_context().
Returns:

A Location object.

rotate_backups.coerce_retention_period(value)[source]

Coerce a retention period to a Python value.

Parameters:value – A string containing the text ‘always’, a number or an expression that can be evaluated to a number.
Returns:A number or the string ‘always’.
Raises:ValueError when the string can’t be coerced.
rotate_backups.load_config_file(configuration_file=None, expand=True)[source]

Load a configuration file with backup directories and rotation schemes.

Parameters:
  • configuration_file – Override the pathname of the configuration file to load (a string or None).
  • expandTrue to expand filename patterns to their matches, False otherwise.
Returns:

A generator of tuples with four values each:

  1. An execution context created using executor.contexts.
  2. The pathname of a directory with backups (a string).
  3. A dictionary with the rotation scheme.
  4. A dictionary with additional options.

Raises:

ValueError when configuration_file is given but doesn’t exist or can’t be loaded.

This function is used by RotateBackups to discover user defined rotation schemes and by rotate_backups.cli to discover directories for which backup rotation is configured. When configuration_file isn’t given ConfigLoader is used to search for configuration files in the following locations:

  • /etc/rotate-backups.ini and /etc/rotate-backups.d/*.ini
  • ~/.rotate-backups.ini and ~/.rotate-backups.d/*.ini
  • ~/.config/rotate-backups.ini and ~/.config/rotate-backups.d/*.ini

All of the available configuration files are loaded in the order given above, so that sections in user-specific configuration files override sections by the same name in system-wide configuration files.

rotate_backups.rotate_backups(directory, rotation_scheme, **options)[source]

Rotate the backups in a directory according to a flexible rotation scheme.

Note

This function exists to preserve backwards compatibility with older versions of the rotate-backups package where all of the logic was exposed as a single function. Please refer to the documentation of the RotateBackups initializer and the rotate_backups() method for an explanation of this function’s parameters.

class rotate_backups.RotateBackups(rotation_scheme, **options)[source]

Python API for the rotate-backups program.

Here’s an overview of the RotateBackups class:

Superclass: PropertyManager
Special methods: __init__()
Public methods: apply_rotation_scheme(), collect_backups(), find_preservation_criteria(), group_backups(), load_config_file(), match_to_datetime(), rotate_backups() and rotate_concurrent()
Properties: config_file, dry_run, exclude_list, force, include_list, io_scheduling_class, prefer_recent, removal_command, rotation_scheme, strict and timestamp_pattern

When you initialize a RotateBackups object you are required to provide a value for the rotation_scheme property. You can set the values of the config_file, dry_run, exclude_list, force, include_list, io_scheduling_class, prefer_recent, removal_command, rotation_scheme, strict and timestamp_pattern properties by passing keyword arguments to the class initializer.

__init__(rotation_scheme, **options)[source]

Initialize a RotateBackups object.

Parameters:
config_file[source]

The pathname of a configuration file (a string or None).

When this property is set rotate_backups() will use load_config_file() to give the user (operator) a chance to set the rotation scheme and other options via a configuration file.

Note

The config_file property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

dry_run[source]

True to simulate rotation, False to actually remove backups (defaults to False).

If this is True then rotate_backups() won’t make any actual changes, which provides a ‘preview’ of the effect of the rotation scheme. Right now this is only useful in the command line interface because there’s no return value.

Note

The dry_run property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

exclude_list[source]

Filename patterns to exclude specific backups (a list of strings).

This is a list of strings with fnmatch patterns. When collect_backups() encounters a backup whose name matches any of the patterns in this list the backup will be ignored, even if it also matches the include list (it’s the only logical way to combine both lists).

See also:include_list

Note

The exclude_list property is a custom_property. You can change the value of this property using normal attribute assignment syntax. This property’s value is computed once (the first time it is accessed) and the result is cached. To clear the cached value you can use del or delattr().

force[source]

True to continue if sanity checks fail, False to raise an exception.

Sanity checks are performed before backup rotation starts to ensure that the given location exists, is readable and is writable. If removal_command is customized then the last sanity check (that the given location is writable) is skipped (because custom removal commands imply custom semantics, see also #18). If a sanity check fails an exception is raised, but you can set force to True to continue with backup rotation instead (the default is obviously False).

Note

The force property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

include_list[source]

Filename patterns to select specific backups (a list of strings).

This is a list of strings with fnmatch patterns. When it’s not empty collect_backups() will only collect backups whose name matches a pattern in the list.

See also:exclude_list

Note

The include_list property is a custom_property. You can change the value of this property using normal attribute assignment syntax. This property’s value is computed once (the first time it is accessed) and the result is cached. To clear the cached value you can use del or delattr().

io_scheduling_class[source]

The I/O scheduling class for backup rotation (a string or None).

When this property is set (and have_ionice is True) then ionice will be used to set the I/O scheduling class for backup rotation. This can be useful to reduce the impact of backup rotation on the rest of the system.

The value of this property is expected to be one of the strings ‘idle’, ‘best-effort’ or ‘realtime’.

Note

The io_scheduling_class property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

prefer_recent[source]

Whether to prefer older or newer backups in each time slot (a boolean).

Defaults to False which means the oldest backup in each time slot (an hour, a day, etc.) is preserved while newer backups in the time slot are removed. You can set this to True if you would like to preserve the newest backup in each time slot instead.

Note

The prefer_recent property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

removal_command[source]

The command used to remove backups (a list of strings).

By default the command rm -fR is used. This choice was made because it works regardless of whether the user’s “backups to be rotated” are files or directories or a mixture of both.

Note

The removal_command property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

rotation_scheme[source]

The rotation scheme to apply to backups (a dictionary).

Each key in this dictionary defines a rotation frequency (one of the strings ‘minutely’, ‘hourly’, ‘daily’, ‘weekly’, ‘monthly’ and ‘yearly’) and each value defines a retention count:

  • An integer value represents the number of backups to preserve in the given rotation frequency, starting from the most recent backup and counting back in time.
  • The string ‘always’ means all backups in the given rotation frequency are preserved (this is intended to be used with the biggest frequency in the rotation scheme, e.g. yearly).

No backups are preserved for rotation frequencies that are not present in the dictionary.

Note

The rotation_scheme property is a required_property. You are required to provide a value for this property by calling the constructor of the class that defines the property with a keyword argument named rotation_scheme (unless a custom constructor is defined, in this case please refer to the documentation of that constructor). You can change the value of this property using normal attribute assignment syntax.

strict[source]

Whether to enforce the time window for each rotation frequency (a boolean, defaults to True).

The easiest way to explain the difference between strict and relaxed rotation is using an example:

  • If strict is True and the number of hourly backups to preserve is three, only backups created in the relevant time window (the hour of the most recent backup and the two hours leading up to that) will match the hourly frequency.
  • If strict is False then the three most recent backups will all match the hourly frequency (and thus be preserved), regardless of the calculated time window.

If the explanation above is not clear enough, here’s a simple way to decide whether you want to customize this behavior:

  • If your backups are created at regular intervals and you never miss an interval then the default (True) is most likely fine.
  • If your backups are created at irregular intervals then you may want to set strict to False to convince RotateBackups to preserve more backups.

Note

The strict property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

timestamp_pattern[source]

The pattern used to extract timestamps from filenames (defaults to TIMESTAMP_PATTERN).

The value of this property is a compiled regular expression object. Callers can provide their own compiled regular expression which makes it possible to customize the compilation flags (see the re.compile() documentation for details).

The regular expression pattern is expected to be a Python compatible regular expression that defines the named capture groups ‘year’, ‘month’ and ‘day’ and optionally ‘hour’, ‘minute’ and ‘second’.

String values are automatically coerced to compiled regular expressions by calling coerce_pattern(), in this case only the re.VERBOSE flag is used.

If the caller provides a custom pattern it will be validated to confirm that the pattern contains named capture groups corresponding to each of the required date components defined by SUPPORTED_DATE_COMPONENTS.

Note

The timestamp_pattern property is a mutable_property. You can change the value of this property using normal attribute assignment syntax. To reset it to its default (computed) value you can use del or delattr().

rotate_concurrent(*locations, **kw)[source]

Rotate the backups in the given locations concurrently.

Parameters:

This function uses rotate_backups() to prepare rotation commands for the given locations and then it removes backups in parallel, one backup per mount point at a time.

The idea behind this approach is that parallel rotation is most useful when the files to be removed are on different disks and so multiple devices can be utilized at the same time.

Because mount points are per system rotate_concurrent() will also parallelize over backups located on multiple remote systems.

rotate_backups(location, load_config=True, prepare=False)[source]

Rotate the backups in a directory according to a flexible rotation scheme.

Parameters:
  • location – Any value accepted by coerce_location().
  • load_config – If True (so by default) the rotation scheme and other options can be customized by the user in a configuration file. In this case the caller’s arguments are only used when the configuration file doesn’t define a configuration for the location.
  • prepare – If this is True (not the default) then rotate_backups() will prepare the required rotation commands without running them.
Returns:

A list with the rotation commands (ExternalCommand objects).

Raises:

ValueError when the given location doesn’t exist, isn’t readable or isn’t writable. The third check is only performed when dry run isn’t enabled.

This function binds the main methods of the RotateBackups class together to implement backup rotation with an easy to use Python API. If you’re using rotate-backups as a Python API and the default behavior is not satisfactory, consider writing your own rotate_backups() function based on the underlying collect_backups(), group_backups(), apply_rotation_scheme() and find_preservation_criteria() methods.

load_config_file(location)[source]

Load a rotation scheme and other options from a configuration file.

Parameters:location – Any value accepted by coerce_location().
Returns:The configured or given Location object.
collect_backups(location)[source]

Collect the backups at the given location.

Parameters:location – Any value accepted by coerce_location().
Returns:A sorted list of Backup objects (the backups are sorted by their date).
Raises:ValueError when the given directory doesn’t exist or isn’t readable.
match_to_datetime(match)[source]

Convert a regular expression match to a datetime value.

Parameters:match – A regular expression match object.
Returns:A datetime value.
Raises:exceptions.ValueError when a required date component is not captured by the pattern, the captured value is an empty string or the captured value cannot be interpreted as a base-10 integer.
group_backups(backups)[source]

Group backups collected by collect_backups() by rotation frequencies.

Parameters:backups – A set of Backup objects.
Returns:A dict whose keys are the names of rotation frequencies (‘hourly’, ‘daily’, etc.) and whose values are dictionaries. Each nested dictionary contains lists of Backup objects that are grouped together because they belong into the same time unit for the corresponding rotation frequency.
apply_rotation_scheme(backups_by_frequency, most_recent_backup)[source]

Apply the user defined rotation scheme to the result of group_backups().

Parameters:
  • backups_by_frequency – A dict in the format generated by group_backups().
  • most_recent_backup – The datetime of the most recent backup.
Raises:

ValueError when the rotation scheme dictionary is empty (this would cause all backups to be deleted).

Note

This method mutates the given data structure by removing all backups that should be removed to apply the user defined rotation scheme.

find_preservation_criteria(backups_by_frequency)[source]

Collect the criteria used to decide which backups to preserve.

Parameters:backups_by_frequency – A dict in the format generated by group_backups() which has been processed by apply_rotation_scheme().
Returns:A dict with Backup objects as keys and list objects containing strings (rotation frequencies) as values.
class rotate_backups.Location(**kw)[source]

Location objects represent a root directory containing backups.

Here’s an overview of the Location class:

Superclass: PropertyManager
Special methods: __str__()
Public methods: add_hints(), ensure_exists(), ensure_readable(), ensure_writable() and match()
Properties: context, directory, have_ionice, have_wildcards, is_remote, key_properties, mount_point and ssh_alias

When you initialize a Location object you are required to provide values for the context and directory properties. You can set the values of the context and directory properties by passing keyword arguments to the class initializer.

context[source]

An execution context created using executor.contexts.

Note

The context property is a required_property. You are required to provide a value for this property by calling the constructor of the class that defines the property with a keyword argument named context (unless a custom constructor is defined, in this case please refer to the documentation of that constructor). You can change the value of this property using normal attribute assignment syntax.

directory[source]

The pathname of a directory containing backups (a string).

Note

The directory property is a required_property. You are required to provide a value for this property by calling the constructor of the class that defines the property with a keyword argument named directory (unless a custom constructor is defined, in this case please refer to the documentation of that constructor). You can change the value of this property using normal attribute assignment syntax.

have_ionice[source]

True when ionice is available, False otherwise.

Note

The have_ionice property is a lazy_property. This property’s value is computed once (the first time it is accessed) and the result is cached.

have_wildcards[source]

True if directory is a filename pattern, False otherwise.

Note

The have_wildcards property is a lazy_property. This property’s value is computed once (the first time it is accessed) and the result is cached.

mount_point[source]

The pathname of the mount point of directory (a string or None).

If the stat --format=%m ... command that is used to determine the mount point fails, the value of this property defaults to None. This enables graceful degradation on e.g. Mac OS X whose stat implementation is rather bare bones compared to GNU/Linux.

Note

The mount_point property is a lazy_property. This property’s value is computed once (the first time it is accessed) and the result is cached.

is_remote[source]

True if the location is remote, False otherwise.

Note

The is_remote property is a lazy_property. This property’s value is computed once (the first time it is accessed) and the result is cached.

ssh_alias[source]

The SSH alias of a remote location (a string or None).

Note

The ssh_alias property is a lazy_property. This property’s value is computed once (the first time it is accessed) and the result is cached.

key_properties

A list of strings with the names of the key properties.

Overrides key_properties to customize the ordering of Location objects so that they are ordered first by their ssh_alias and second by their directory.

ensure_exists(override=False)[source]

Sanity check that the location exists.

Parameters:overrideTrue to log a message, False to raise an exception (when the sanity check fails).
Returns:True if the sanity check succeeds, False if it fails (and override is True).
Raises:ValueError when the sanity check fails and override is False.
ensure_readable(override=False)[source]

Sanity check that the location exists and is readable.

Parameters:overrideTrue to log a message, False to raise an exception (when the sanity check fails).
Returns:True if the sanity check succeeds, False if it fails (and override is True).
Raises:ValueError when the sanity check fails and override is False.
ensure_writable(override=False)[source]

Sanity check that the directory exists and is writable.

Parameters:overrideTrue to log a message, False to raise an exception (when the sanity check fails).
Returns:True if the sanity check succeeds, False if it fails (and override is True).
Raises:ValueError when the sanity check fails and override is False.
add_hints(message)[source]

Provide hints about failing sanity checks.

Parameters:message – The message to the user (a string).
Returns:The message including hints (a string).

When superuser privileges aren’t being used a hint about the --use-sudo option will be added (in case a sanity check failed because we don’t have permission to one of the parent directories).

In all cases a hint about the --force option is added (in case the sanity checks themselves are considered the problem, which is obviously up to the operator to decide).

match(location)[source]

Check if the given location “matches”.

Parameters:location – The Location object to try to match.
Returns:True if the two locations are on the same system and the directory can be matched as a filename pattern or a literal match on the normalized pathname.
__str__()[source]

Render a simple human readable representation of a location.

class rotate_backups.Backup(**kw)[source]

Backup objects represent a rotation subject.

Here’s an overview of the Backup class:

Superclass: PropertyManager
Special methods: __getattr__()
Properties: pathname, timestamp and week

When you initialize a Backup object you are required to provide values for the pathname and timestamp properties. You can set the values of the pathname and timestamp properties by passing keyword arguments to the class initializer.

key_properties = ('timestamp', 'pathname')

Customize the ordering of Backup objects.

Backup objects are ordered first by their timestamp and second by their pathname. This class variable overrides key_properties.

pathname[source]

The pathname of the backup (a string).

Note

The pathname property is a key_property. You are required to provide a value for this property by calling the constructor of the class that defines the property with a keyword argument named pathname (unless a custom constructor is defined, in this case please refer to the documentation of that constructor). Once this property has been assigned a value you are not allowed to assign a new value to the property.

timestamp[source]

The date and time when the backup was created (a datetime object).

Note

The timestamp property is a key_property. You are required to provide a value for this property by calling the constructor of the class that defines the property with a keyword argument named timestamp (unless a custom constructor is defined, in this case please refer to the documentation of that constructor). Once this property has been assigned a value you are not allowed to assign a new value to the property.

week

The ISO week number of timestamp (a number).

__getattr__(name)[source]

Defer attribute access to timestamp.

rotate_backups.cli

Usage: rotate-backups [OPTIONS] [DIRECTORY, ..]

Easy rotation of backups based on the Python package by the same name.

To use this program you specify a rotation scheme via (a combination of) the --hourly, --daily, --weekly, --monthly and/or --yearly options and the directory (or directories) containing backups to rotate as one or more positional arguments.

You can rotate backups on a remote system over SSH by prefixing a DIRECTORY with an SSH alias and separating the two with a colon (similar to how rsync accepts remote locations).

Instead of specifying directories and a rotation scheme on the command line you can also add them to a configuration file. For more details refer to the online documentation (see also the --config option).

Please use the --dry-run option to test the effect of the specified rotation scheme before letting this program loose on your precious backups! If you don’t test the results using the dry run mode and this program eats more backups than intended you have no right to complain ;-).

Supported options:

Option Description
-M, --minutely=COUNT In a literal sense this option sets the number of “backups per minute” to preserve during rotation. For most use cases that doesn’t make a lot of sense :-) but you can combine the --minutely and --relaxed options to preserve more than one backup per hour. Refer to the usage of the -H, --hourly option for details about COUNT.
-H, --hourly=COUNT

Set the number of hourly backups to preserve during rotation:

  • If COUNT is a number it gives the number of hourly backups to preserve, starting from the most recent hourly backup and counting back in time.
  • Alternatively you can provide an expression that will be evaluated to get a number (e.g. if COUNT is “7 * 2” the result would be 14).
  • You can also pass “always” for COUNT, in this case all hourly backups are preserved.
  • By default no hourly backups are preserved.
-d, --daily=COUNT Set the number of daily backups to preserve during rotation. Refer to the usage of the -H, --hourly option for details about COUNT.
-w, --weekly=COUNT Set the number of weekly backups to preserve during rotation. Refer to the usage of the -H, --hourly option for details about COUNT.
-m, --monthly=COUNT Set the number of monthly backups to preserve during rotation. Refer to the usage of the -H, --hourly option for details about COUNT.
-y, --yearly=COUNT Set the number of yearly backups to preserve during rotation. Refer to the usage of the -H, --hourly option for details about COUNT.
-t, --timestamp-pattern=PATTERN Customize the regular expression pattern that is used to match and extract timestamps from filenames. PATTERN is expected to be a Python compatible regular expression that must define the named capture groups ‘year’, ‘month’ and ‘day’ and may define ‘hour’, ‘minute’ and ‘second’.
-I, --include=PATTERN Only process backups that match the shell pattern given by PATTERN. This argument can be repeated. Make sure to quote PATTERN so the shell doesn’t expand the pattern before it’s received by rotate-backups.
-x, --exclude=PATTERN Don’t process backups that match the shell pattern given by PATTERN. This argument can be repeated. Make sure to quote PATTERN so the shell doesn’t expand the pattern before it’s received by rotate-backups.
-j, --parallel

Remove backups in parallel, one backup per mount point at a time. The idea behind this approach is that parallel rotation is most useful when the files to be removed are on different disks and so multiple devices can be utilized at the same time.

Because mount points are per system the -j, --parallel option will also parallelize over backups located on multiple remote systems.

-p, --prefer-recent By default the first (oldest) backup in each time slot is preserved. If you’d prefer to keep the most recent backup in each time slot instead then this option is for you.
-r, --relaxed

By default the time window for each rotation scheme is enforced (this is referred to as strict rotation) but the -r, --relaxed option can be used to alter this behavior. The easiest way to explain the difference between strict and relaxed rotation is using an example:

  • When using strict rotation and the number of hourly backups to preserve is three, only backups created in the relevant time window (the hour of the most recent backup and the two hours leading up to that) will match the hourly frequency.
  • When using relaxed rotation the three most recent backups will all match the hourly frequency (and thus be preserved), regardless of the calculated time window.

If the explanation above is not clear enough, here’s a simple way to decide whether you want to customize this behavior or not:

  • If your backups are created at regular intervals and you never miss an interval then strict rotation (the default) is probably the best choice.
  • If your backups are created at irregular intervals then you may want to use the -r, --relaxed option in order to preserve more backups.
-i, --ionice=CLASS Use the “ionice” program to set the I/O scheduling class and priority of the “rm” invocations used to remove backups. CLASS is expected to be one of the values “idle” (3), “best-effort” (2) or “realtime” (1). Refer to the man page of the “ionice” program for details about these values. The numeric values are required by the ‘busybox’ implementation of ‘ionice’.
-c, --config=FILENAME

Load configuration from FILENAME. If this option isn’t given the following default locations are searched for configuration files:

  • /etc/rotate-backups.ini and /etc/rotate-backups.d/*.ini
  • ~/.rotate-backups.ini and ~/.rotate-backups.d/*.ini
  • ~/.config/rotate-backups.ini and ~/.config/rotate-backups.d/*.ini

Any available configuration files are loaded in the order given above, so that sections in user-specific configuration files override sections by the same name in system-wide configuration files. For more details refer to the online documentation.

-C, --removal-command=CMD

Change the command used to remove backups. The value of CMD defaults to rm ``-f``R. This choice was made because it works regardless of whether “backups to be rotated” are files or directories or a mixture of both.

As an example of why you might want to change this, CephFS snapshots are represented as regular directory trees that can be deleted at once with a single ‘rmdir’ command (even though according to POSIX semantics this command should refuse to remove nonempty directories, but I digress).

-u, --use-sudo Enable the use of “sudo” to rotate backups in directories that are not readable and/or writable for the current user (or the user logged in to a remote system over SSH).
-S, --syslog=CHOICE Explicitly enable or disable system logging instead of letting the program figure out what to do. The values ‘1’, ‘yes’, ‘true’ and ‘on’ enable system logging whereas the values ‘0’, ‘no’, ‘false’ and ‘off’ disable it.
-f, --force If a sanity check fails an error is reported and the program aborts. You can use --force to continue with backup rotation instead. Sanity checks are done to ensure that the given DIRECTORY exists, is readable and is writable. If the --removal-command option is given then the last sanity check (that the given location is writable) is skipped (because custom removal commands imply custom semantics).
-n, --dry-run Don’t make any changes, just print what would be done. This makes it easy to evaluate the impact of a rotation scheme without losing any backups.
-v, --verbose Increase logging verbosity (can be repeated).
-q, --quiet Decrease logging verbosity (can be repeated).
-h, --help Show this message and exit.
rotate_backups.cli.main()[source]

Command line interface for the rotate-backups program.