Update of /cvsroot/mhonarc/mharc/bin
In directory subversions:/tmp/cvs-serv24959/bin
Modified Files:
compress-files compress-mboxes gc-search-indexes
Log Message:
* bin/compress-files:
. Add POD. Execute './bin/compress-files -man' to view
documentation.
* bin/compress-mboxes:
. Converted to Perl. POD added along with some command-line options.
Execute './bin/compress-mboxes -man' to view documentation.
* bin/gc-search-indexes
. Converted to Perl. POD added along with some command-line options.
Execute './bin/gc-search-indexes -man' to view documentation.
Index: compress-files
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/compress-files,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** compress-files 7 Mar 2002 02:03:31 -0000 1.4
--- compress-files 9 Jul 2002 01:30:49 -0000 1.5
***************
*** 33,53 ****
use lib "$Dir/../lib"; # Add relative lib to search path
- use MHArc::Config;
- my $config = MHArc::Config->load("$Dir/../lib/config.sh");
-
-
use Getopt::Long;
use File::Find;
! my $debug = 0;
! my $pattern = '^[^.]';
! my $compress_time = 31;
! my $noact = 0;
! GetOptions(
! "debug!" => \$debug,
! "pattern=s" => \$pattern,
! "mtime=i" => \$compress_time,
! "n!" => \$noact
);
my $time = time;
--- 33,57 ----
use lib "$Dir/../lib"; # Add relative lib to search path
use Getopt::Long;
use File::Find;
! my %opt = ( );
! my $clstatus = GetOptions(\%opt,
! "debug!",
! "pattern=s",
! "mtime=i",
! "n!",
!
! 'help',
! 'man'
);
+ usage(0) unless $clstatus;
+ usage(1) if $opt{'help'};
+ usage(2) if $opt{'man'};
+
+ my $debug = $opt{'debug'};
+ my $pattern = $opt{'pattern'} || '^[^.]';
+ my $compress_time = $opt{'mtime'} || 31;
+ my $noact = $opt{'n'};
my $time = time;
***************
*** 83,84 ****
--- 87,157 ----
}
find(\&wanted, @ARGV);
+
+ ##---------------------------------------------------------------------------##
+ __END__
+
+ =head1 NAME
+
+ compress-files - Gzip files not modified over a given period of time
+
+ =head1 SYNOPSIS
+
+ compress-files [options] <directory> [<directory> ...]
+
+ =head1 DESCRIPTION
+
+ This program is part of MHArc, the auto-archiving system that works in
+ conjuction with Procmail, Namazu, and a collection of shell and
+ Perl programs. This program is used to compress files that have not
+ been modified over a given period of time.
+
+ =head1 OPTIONS
+
+ =item C<-debug>
+
+ Print out alot of status information.
+
+ =item C<-help>
+
+ Print out usage information.
+
+ =item C<-n>
+
+ Print the commands that would be executed, but do not execute them.
+
+ =item C<-man>
+
+ Print out manpage.
+
+ =item C<-mtime> I<days>
+
+ Modification time in days a file has to be older than to get compressed.
+ If this option is not specified, 31 days is used.
+
+ =item C<-pattern> I<regex>
+
+ Perl regular expression that represents files that should be
+ checked. If not specifed, the following regex is used:
+ C<^[^.]>.
+
+ =over
+
+ =head1 SEE ALSO
+
+ L<compress-mboxes>
+
+ =head1 VERSION
+
+ $Id$
+
+ =head1 AUTHOR
+
+ Earl Hood, earl(_at_)earlhood(_dot_)com
+
+ This program is part of the MHArc archiving system and comes with
+ ABSOLUTELY NO WARRANTY and may be copied only under the terms of
+ the GNU General Public License, which may be found in the MHArc
+ distribution.
+
+ =cut
+
Index: compress-mboxes
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/compress-mboxes,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** compress-mboxes 5 Mar 2002 18:36:52 -0000 1.3
--- compress-mboxes 9 Jul 2002 01:30:49 -0000 1.4
***************
*** 1,3 ****
! #!/bin/sh
##---------------------------------------------------------------------------##
## File:
--- 1,3 ----
! #!/usr/local/bin/perl
##---------------------------------------------------------------------------##
## File:
***************
*** 24,38 ****
##---------------------------------------------------------------------------##
! PATH=$HOME/bin:/usr/local/bin:/bin:/usr/bin; export PATH
! BASEDIR=`dirname $0`
! # Load configuration
! . $BASEDIR/../lib/config.sh
! # Sanity check on $MBOX_DIR
! if [ ! -d $MBOX_DIR ]; then
! echo "$MBOX_DIR is not a directory!"
! exit 1;
! fi
- exec $BASEDIR/compress-files -pattern '^\d+(?:-\d+)?$' $MBOX_DIR
--- 24,172 ----
##---------------------------------------------------------------------------##
! package MHArc::compress_mboxes;
! my $Dir;
! BEGIN {
! $Dir = `dirname $0`; chomp $Dir;
! }
! use lib "$Dir/../lib"; # Add relative lib to search path
! use MHArc::Config;
! my $config = MHArc::Config->load("$Dir/../lib/config.sh");
!
! use Getopt::Long;
! use MHArc::Util qw( exec_prg usage );
!
! MAIN: {
! my %opt = ( );
! my $clstatus = GetOptions(\%opt,
! "debug!",
! "n!",
!
! 'help',
! 'man'
! );
! usage(0) unless $clstatus;
! usage(1) if $opt{'help'};
! usage(2) if $opt{'man'};
!
! $MHArc::Util::ECHO_CMDS = $noact || $debug;
! $MHArc::Util::ECHO_ONLY = $noact;
!
! $ENV{'PATH'} = join(':', join('/', $config->{'SW_ROOT'}, 'bin'),
! '/usr/local/bin',
! '/bin',
! '/usr/bin');
!
! # Sanity check on $MBOX_DIR
! if (! -d $config->{'MBOX_DIR'}) {
! die qq/ERROR: "/, $config->{'MBOX_DIR'}, qq/" is not a directory!/;
! }
!
! # Call compress-files
! my @cmd_args = (
! '-pattern', '^\d+(?:-\d+)?$',
! );
! if ($opt{'n'}) {
! push(@cmd_args, '-n');
! }
! if ($opt{'debug'}) {
! push(@cmd_args, '-debug');
! }
! exec_prg("$Dir/compress-files", @cmd_args, $config->{'MBOX_DIR'});
!
! } # End: MAIN
!
! ##---------------------------------------------------------------------------##
! __END__
!
! =head1 NAME
!
! compress-mboxes - Gzip old raw mailbox files
!
! =head1 SYNOPSIS
!
! compress-mboxes
! compress-mboxes [options]
!
! =head1 DESCRIPTION
!
! This program is part of MHArc, the auto-archiving system that works in
! conjuction with Procmail, Namazu, and a collection of shell and
! Perl programs. This program has the responsibility of gzipping
! mailbox files that have not been modified in over a month to save
! disk space.
!
! Generally, this program will be invoked automatically from C<cron>
! on a periodic basis.
!
! This program will use the C<MBOX_DIR> variable from
! C<I<mharc-root>/lib/config.sh> as the root directory to search for
! mailbox files. Any file matching the following regex,
!
! ^\d+(?:-\d+)?$
!
! is considered to be a mailbox file.
!
! =head1 OPTIONS
!
! =over
!
! =item C<-debug>
!
! Print out alot of status information.
!
! =item C<-help>
!
! Print out usage information.
!
! =item C<-n>
!
! Print the commands that would be executed, but do not execute them.
!
! =item C<-man>
!
! Print out manpage.
!
! =back
!
! =head1 FILES
!
! =over
!
! =item C<I<mharc-root>/lib/config.sh>
!
! Main configuration file for MHArc.
!
! =back
!
! =head1 NOTES
!
! =over
!
! =item *
!
! This program basically invokes L<compress-files> with the proper
! arguments to do the actual work.
!
! =back
!
! =head1 SEE ALSO
!
! L<compress-files>
!
! =head1 VERSION
!
! $Id$
!
! =head1 AUTHOR
!
! Earl Hood, earl(_at_)earlhood(_dot_)com
!
! This program is part of the MHArc archiving system and comes with
! ABSOLUTELY NO WARRANTY and may be copied only under the terms of
! the GNU General Public License, which may be found in the MHArc
! distribution.
!
! =cut
Index: gc-search-indexes
===================================================================
RCS file: /cvsroot/mhonarc/mharc/bin/gc-search-indexes,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gc-search-indexes 5 Mar 2002 18:36:52 -0000 1.3
--- gc-search-indexes 9 Jul 2002 01:30:49 -0000 1.4
***************
*** 1,3 ****
! #!/bin/sh -e
##---------------------------------------------------------------------------##
## File:
--- 1,3 ----
! #!/usr/local/bin/perl
##---------------------------------------------------------------------------##
## File:
***************
*** 24,39 ****
##---------------------------------------------------------------------------##
! PATH=$HOME/bin:/usr/local/bin:/bin:/usr/bin; export PATH
! BASEDIR=`dirname $0`
! # Load configuration
! . $BASEDIR/../lib/config.sh
! # Sanity check on $HTML_DIR
! if [ ! -d $HTML_DIR ]; then
! echo "$HTML_DIR is not a directory!"
! exit 1;
! fi
- # Run garbage collection
- exec gcnmz -q -b `find $HTML_DIR/* -type d \! -name 'RCS' -print -prune`
--- 24,189 ----
##---------------------------------------------------------------------------##
! package MHArc::compress_mboxes;
! my $Dir;
! BEGIN {
! $Dir = `dirname $0`; chomp $Dir;
! }
! use lib "$Dir/../lib"; # Add relative lib to search path
! use MHArc::Config;
! my $config = MHArc::Config->load("$Dir/../lib/config.sh");
!
! use Getopt::Long;
! use MHArc::Util qw( cmd usage );
!
! MAIN: {
! my %opt = ( );
! my $clstatus = GetOptions(\%opt,
! "debug!",
! "n!",
!
! 'help',
! 'man'
! );
! usage(0) unless $clstatus;
! usage(1) if $opt{'help'};
! usage(2) if $opt{'man'};
!
! my $debug = $opt{'debug'};
! my $noact = $opt{'n'};
!
! $ENV{'PATH'} = join(':', join('/', $config->{'SW_ROOT'}, 'bin'),
! '/usr/local/bin',
! '/bin',
! '/usr/bin');
!
! $MHArc::Util::ECHO_CMDS = $noact || $debug;
! $MHArc::Util::ECHO_ONLY = $noact;
!
! print "PATH=$ENV{'PATH'}\n" if $debug;
!
! # Sanity check on $HTML_DIR
! my $html_dir = $config->{'HTML_DIR'};
! if (! -d $html_dir) {
! die qq/ERROR: "/, $html_dir, qq/" is not a directory!/;
! }
! print qq/HTML_DIR=$html_dir\n/ if $debug;
!
! # Get list of possible directories
! opendir(HTML_DIR, $html_dir) ||
! die qq/ERROR: Unable to open "$html_dir" for reading: $!\n/;
! my @dirs = map { "$html_dir/$_" }
! grep { ($_ ne '.') &&
! ($_ ne '..') &&
! (-d "$html_dir/$_") &&
! (-e "$html_dir/$_/NMZ.t") } readdir(HTML_DIR);
!
! # Check that we have something to do
! if (!scalar(@dirs)) {
! print "No search indexes found\n" if $debug;
! exit 0;
! }
! print "Searchable directories:\n\t",
! join("\n\t", @dirs), "\n" if $debug;
!
! # Run garbage collection
! my @cmd_args = ( '-b' );
! if ($debug) {
! push(@cmd_args, '-v');
! } else {
! push(@cmd_args, '-q');
! }
! foreach (@dirs) {
! if (cmd('gcnmz', @cmd_args, $_) != 0) {
! warn qq/Warning: Command "gcnmz @cmd_args $_" failed: $?\n/;
! }
! }
!
! } # End: MAIN
!
! ##---------------------------------------------------------------------------##
! __END__
!
! =head1 NAME
!
! gc-search-indexes - Garbage collect archive search indexes.
!
! =head1 SYNOPSIS
!
! gc-search-indexes
! gc-search-indexes [options]
!
! =head1 DESCRIPTION
!
! This program is part of MHArc, the auto-archiving system that works in
! conjuction with Procmail, Namazu, and a collection of shell and
! Perl programs. This program has the responsibility of performing
! garbage collection on archive search indexes.
!
! Generally, this program will be invoked automatically from C<cron>
! on a periodic basis.
!
! This program will use the C<HTML_DIR> variable from
! C<I<mharc-root>/lib/config.sh> as the root directory to search for
! searchable archives.
!
! =head1 OPTIONS
!
! =over
!
! =item C<-debug>
!
! Print out alot of information on what is going on.
!
! =item C<-help>
!
! Print out usage information.
!
! =item C<-n>
!
! Print the commands that would be executed, but do not execute them.
!
! =item C<-man>
!
! Print out manpage.
!
! =back
!
! =head1 FILES
!
! =over
!
! =item C<I<mharc-root>/lib/config.sh>
!
! Main configuration file for MHArc.
!
! =back
!
! =head1 NOTES
!
! =over
!
! =item *
!
! This program should be invoked occasionally, like once a week. The
! template crontab provided with MHArc provides a useful crontab entry
! for invoking this program.
!
! =back
!
! =head1 VERSION
!
! $Id$
!
! =head1 AUTHOR
!
! Earl Hood, earl(_at_)earlhood(_dot_)com
!
! This program is part of the MHArc archiving system and comes with
! ABSOLUTELY NO WARRANTY and may be copied only under the terms of
! the GNU General Public License, which may be found in the MHArc
! distribution.
!
! =cut
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV