2 ##--------------------------------------------------------------------------##
4 ## $Id: read-mail,v 1.10 2002/09/15 03:33:08 ehood Exp $
6 ## Read mail spool and archive messages.
7 ##--------------------------------------------------------------------------##
8 ## Copyright (C) 2001 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
::read_mail
;
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( ch_dir cmd usage );
46 # Grap command-line options
48 my $clstatus = GetOptions
(\
%opt,
56 usage
(0) unless $clstatus;
57 usage
(1) if $opt{'help'};
58 usage
(2) if $opt{'man'};
60 my $verbose = $opt{'verbose'};
62 $MHArc::Util
::ECHO_CMDS
= 1;
65 my $home = $opt{'home'} ||
66 $config->{'SW_ROOT'} ||
68 my $force = $opt{'force'};
71 die qq/ERROR: Unable to change directory to "$home": $!\n/;
73 if (-e
'.noarchive') {
74 print "Archiving is currently disabled\n" if $verbose;
78 print "However, -force specified, so continuing...\n" if $verbose;
82 push(@cmd_args, '-verbose') if $verbose;
83 if (cmd
('./bin/filter-spool', @cmd_args) == 0) {
84 cmd
('./bin/web-archive', @cmd_args);
88 ##---------------------------------------------------------------------------##
93 read-mail - Archive incoming mail
102 This program is part of mharc and is the main program for archiving
103 mail. It is generally called via cron.
105 This program does very little itself, but it invokes other mharc
106 scripts to do all the work.
108 If the file C<.noarchive> exists in mharc root directory, then this
109 program will do nothing and exit (unless the C<-force> option is
110 specified). This is to allow one to disable incoming mail processing
111 while performing administrative tasks.
115 This program is generally called without any command-line options
116 since it will read C<E<lt>mharc-rootE<gt>/lib/config.sh> for any configurable
117 options. Regardless, the following command-line options are
124 Print out usage information.
126 =item C<-home> I<pathname>
128 Root pathname of archiving software and data. If not specified,
129 C<SW_ROOT> variable in C<config.sh> is used, else the parent directory
130 that contains this program is used.
134 Print out entire manpage.
138 Print out status messages.
146 =item C<I<mharc-root>/lib/config.sh>
148 Main configuration file for mharc.
154 $Id: read-mail,v 1.10 2002/09/15 03:33:08 ehood Exp $
158 Earl Hood, earl@earlhood.com
160 This program is part of the mharc archiving system and comes with
161 ABSOLUTELY NO WARRANTY and may be copied only under the terms of
162 the GNU General Public License, which may be found in the mharc