Index: trunk/tools/cleandsproduct.pl
===================================================================
--- trunk/tools/cleandsproduct.pl	(revision 39581)
+++ trunk/tools/cleandsproduct.pl	(revision 39582)
@@ -5,20 +5,11 @@
 use strict;
 
-## report the program and machine
-use Sys::Hostname;
-my $host = hostname();
-
 use vars qw( $VERSION );
 $VERSION = '0.01';
 
+use Date::Parse;
+
 use IPC::Cmd 0.36 qw( can_run run );
-use File::Temp qw( tempfile );
-use File::Basename qw( basename );
-use Digest::MD5::File qw( file_md5_hex );
 use PS::IPP::Metadata::Config;
-use PS::IPP::Metadata::List qw( parse_md_list );
-
-use Date::Parse;
-
 use PS::IPP::Config 1.01 qw( :standard );
 
@@ -60,9 +51,8 @@
            ) or pod2usage( 2 );
 
-pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --product",
+pod2usage( -msg => "Unknown option: @ARGV\n", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options: --product\n",
            -exitval => 3) unless
     defined $product;
-
 
 if (!$datastore) {
@@ -73,5 +63,5 @@
 my $uri = "$datastore/$product/index.txt";
 
-# XXX: I'm not sure why this bracket is here
+# XXX: I'm not sure why this bracket and indentation is here
 {
     my $command = "$dsproductls --uri $uri --extra --timeout 150";
@@ -136,2 +126,88 @@
 
 __END__
+
+=pod
+=head1 NAME
+
+cleandsproduct.pl - cleans up a data store product
+
+=head1 SYNOPSIS
+
+cleandsproduct.pl --product <product name> [--last-fileset <filesetid>] [--no-rm] [--retention-days <days>] [--use-configured-publish-retention]
+
+=head1 DESCRIPTION
+
+Uses L<dsproductls> to get a listing of all of the filesets in a data store product, then the program L<dsreg> is used to delete
+the filesets from the data store directory and their representation in the database.
+
+By default, all filesets are deleted. Certain options may be used to stop the cleanup after a given fileset 
+or once all remaining filesets are newer than some time.
+
+=head1 OPTIONS
+
+=over 4
+
+=item --product <product name>
+
+The name of the product to be cleaned up.
+
+Required.
+
+=item --retention-days <days>
+
+The minimum number of days old for filesets to be cleaned.
+Optional.
+
+=item --use-configured-publish-retention
+
+Get retention-days value from the SiteConfig
+Optional.
+
+=item --last_fileset <filesetid>
+
+The FileSet ID of the last FileSet to be cleaned. Note: if the specified fileset is newer than the retention time
+cleanup stops after cleaning that fileset.
+Optional.
+
+=item --no-rm
+
+Update the database but do not remove the files on disk. The files will thus still exist, but they will be invisible
+through the data store interface.
+
+=head1 Configuration Values
+
+The following configuration values are used to set certain default values.
+
+=item DATA_STORE_ROOT_URL 
+
+The http address of the data store. Required.
+
+=item DATA_STORE_PUBLISH_RETENTION_DAYS
+
+The number of days that filesets in the publishing data stores should be preserved. Only used and required if
+the option --use-configured-publish-retention is supplied.
+
+=back
+
+=head1 CREDITS
+
+Bill Sweeney IfA
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Bill Sweeney bills@ifa.hawaii.edu
+
+=head1 COPYRIGHT
+
+Copyright (C) 2011 - 2016  University of Hawaii IfA.
+
+
+=head1 SEE ALSO
+
+L<dsreg> L<dsproductls>
+
+=cut
