App-TrimHistories

 view release on metacpan or  search on metacpan

script/trim-histories  view on Meta::CPAN

# and generated automatically using Perinci::CmdLine::Gen version 0.491

our $DATE = '2019-11-29'; # DATE
our $DIST = 'App-TrimHistories'; # DIST
our $VERSION = '0.006'; # VERSION

use 5.010001;
use strict;
use warnings;
use Log::ger;

use Perinci::CmdLine::Any;

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/TrimHistories/trim_histories",
    program_name => "trim-histories",
    log => 1,
);

$cmdline->run;

# ABSTRACT: Keep only a certain number of sets of file histories, delete the rest
# PODNAME: trim-histories

__END__

=pod

=encoding UTF-8

=head1 NAME

trim-histories - Keep only a certain number of sets of file histories, delete the rest

=head1 VERSION

This document describes version 0.006 of trim-histories (from Perl distribution App-TrimHistories), released on 2019-11-29.

=head1 SYNOPSIS

Usage:

 % trim-histories [options] <file> ...

Examples:

By default keeps 7 daily, 4 weekly, 6 monthly histories, but older files are kept to fill the sets:

 % trim-histories *

Like previous, but older and younger files are deleted:

 % trim-histories --discard-old --discard-young *

Only keep 5 daily, 2 weekly histories:

 % trim-histories --sets daily,5,weekly,2 *

=head1 DESCRIPTION

This script can be used to delete old backup or log files. The files must be
named with timestamps, e.g. C<mydb-2017-06-14.sql.gz>. By default, it keeps only
7 daily, 4 weekly, and 6 monthly histories. The rest will be deleted.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--discard-old-histories>

=item B<--discard-young-histories>

=item B<--file>=I<s@>*

Each file name must be unique and contain date, e.g. `backup-2017-06-14.tar.gz`.

Can be specified multiple times.

=item B<--files-json>=I<s>

Each file name must be unique and contain date, e.g. `backup-2017-06-14.tar.gz` (JSON-encoded).

See C<--file>.

=item B<--sets-json>=I<s>

History sets to keep (JSON-encoded).

See C<--sets>.

=item B<--sets>=I<s@>

History sets to keep.

Default value:

 ["daily",7,"weekly",4,"monthly",6]

Expressed as a list of (period, num-to-keep) pairs. Period can be number of
seconds or either `hourly`, `daily`, `weekly`, `monthly`, `yearly`. The default
is:

    ['daily', 7, 'weekly', 4, 'monthly', 6]

which means to keep 7 daily, 4 weekly, and 6 monthly histories. It is equivalent
to:

    [86400, 7, 7*86400, 4, 30*86400, 6]


Can be specified multiple times.

=back

=head2 Configuration options

=over

=item B<--config-path>=I<s>, B<-c>

Set path to configuration file.

=item B<--config-profile>=I<s>, B<-P>

Set configuration profile to use.

=item B<--no-config>, B<-C>

Do not use any configuration file.

=back

=head2 Environment options

=over

=item B<--no-env>

Do not read environment for default options.

=back



( run in 0.726 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )