diff --git a/scripts/remove_session b/scripts/remove_session index 69514df..8fcc9b2 100755 --- a/scripts/remove_session +++ b/scripts/remove_session @@ -1,5 +1,29 @@ #!/usr/bin/perl +=head1 SYNOPSIS + +remove_session [--age time] [session_ids ...] + +=head1 DESCRIPTION + +The C script removes the specified sessions from the +simba database and then cleans up orphaned entries. + +The sessions can be specified by minimum age or by listing their ids (or +both, but that is probably not very useful). + +The age is specified as a fractional number followed by a unit: "y", +"m", "w", or "d". So C removes all sessions +older than 2.5 years (actually 2.5 * 365 * 86400 seconds -- leap years +and DST are ignored), and C removes all +sessions older than 52 weeks. + +If neither the age nor a list of sessions is specified, no sessions are +removed, but the cleanup phase is still run, which may take considerable +time (and might be considered a bug). + +=cut + # This script removes all data associated with the given sessions. # For each session it first removes all instances of that session and # then cleans up any orphans. @@ -10,6 +34,7 @@ use strict; use Simba::CA; use Bit::Vector::Judy; use Getopt::Long; +use Pod::Usage; $| = 1; @@ -24,7 +49,13 @@ my $partition_size = $ca->{instances_part_size}; my %opt; GetOptions( \%opt, - "age=s"); + "age=s", + "help", +) or pod2usage(verbose => 0); + +if ($opt{help}) { + pod2usage(verbose => 2); +} if ($opt{age}) { my ($num, $unit) = $opt{age} =~ /(\d(?:.\d+)?)(y|m|w|d)/;