2 ##--------------------------------------------------------------------------##
4 ## $Id: compress-mboxes,v 1.8 2002/09/15 03:33:08 ehood Exp $
6 ## Script to compress older mailbox inorder to save disk space.
7 ##--------------------------------------------------------------------------##
8 ## Copyright (C) 2001-2002 Earl Hood <earl@earlhood.com>
10 ## This program is free software; you can redistribute it and/or modify
11 ## it under the terms of the GNU General Public License as published by
12 ## the Free Software Foundation; either version 2 of the License, or
13 ## (at your option) any later version.
15 ## This program is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ## GNU General Public License for more details.
20 ## You should have received a copy of the GNU General Public License
21 ## along with this program; if not, write to the Free Software
22 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 ##--------------------------------------------------------------------------##
26 package MHArc
::compress_mboxes
;
28 ##--------------------------------------------------------------------------##
30 BEGIN { die qq/CGI use FORBIDDEN!\n/ if (defined($ENV{'GATEWAY_INTERFACE'})); }
31 my $Dir; BEGIN { $Dir = `dirname $0`; chomp $Dir; }
32 use lib
"$Dir/../lib"; # Add relative lib to search path
34 ##--------------------------------------------------------------------------##
37 my $config = MHArc
::Config
->load("$Dir/../lib/config.sh");
39 ##--------------------------------------------------------------------------##
43 use MHArc
::Util
qw( exec_prg usage );
47 my $clstatus = GetOptions
(\
%opt,
54 usage
(0) unless $clstatus;
55 usage
(1) if $opt{'help'};
56 usage
(2) if $opt{'man'};
58 my $debug = $opt{'debug'};
59 my $noact = $opt{'n'};
61 $MHArc::Util
::ECHO_CMDS
= $noact || $debug;
62 $MHArc::Util
::ECHO_ONLY
= $noact;
64 $ENV{'PATH'} = join(':', join('/', $config->{'SW_ROOT'}, 'bin'),
69 # Sanity check on $MBOX_DIR
70 if (! -d
$config->{'MBOX_DIR'}) {
71 die qq/ERROR: "/, $config->{'MBOX_DIR'}, qq/" is not a directory!/;
79 push(@cmd_args, '-n');
82 push(@cmd_args, '-debug');
84 exec("$Dir/compress-files", @cmd_args, $config->{'MBOX_DIR'});
85 die qq/exec @_ failed: $?\n/;
89 ##---------------------------------------------------------------------------##
94 compress-mboxes - Gzip old raw mailbox files
99 compress-mboxes [options]
103 This program is part of mharc and has the responsibility of gzipping
104 mailbox files that have not been modified in over a month to save
107 Generally, this program will be invoked automatically from C<cron>
110 This program will use the C<MBOX_DIR> variable from
111 C<E<lt>mharc-rootE<gt>/lib/config.sh> as the root directory to search for
112 mailbox files. Any file matching the following regex,
116 is considered to be a mailbox file.
124 Print out alot of status information.
128 Print out usage information.
132 Print the commands that would be executed, but do not execute them.
144 =item C<E<lt>mharc-rootE<gt>/lib/config.sh>
146 Main configuration file for mharc.
156 This program basically invokes L<compress-files|compress-files> with the proper
157 arguments to do the actual work.
163 L<compress-files|compress-files>
167 $Id: compress-mboxes,v 1.8 2002/09/15 03:33:08 ehood Exp $
171 Earl Hood, earl@earlhood.com
173 This program is part of the mharc archiving system and comes with
174 ABSOLUTELY NO WARRANTY and may be copied only under the terms of
175 the GNU General Public License, which may be found in the mharc