# HG changeset patch # User Heiko Schlittermann # Date 1464736144 -7200 # Node ID 4a17eef44b7c7758f8cdc2fe954759c9a64dafe6 # Parent 8525154c1389ac585954ca21c5beafe564e0d96f Improve help and add pod2usage() diff -r 8525154c1389 -r 4a17eef44b7c README --- a/README Wed Jun 01 00:54:05 2016 +0200 +++ b/README Wed Jun 01 01:09:04 2016 +0200 @@ -1,2 +1,19 @@ The documenation is currently only available from http://www.schlittermann.de/doc/grey + + +Example configuration snippet +----------------------------- + +perl_startup = use Exim::Grey qw(unseen); +GREYLISTED = ${perl{unseen}{<$sender_address>:<$local_part@$domain>/$sender_host_address}{60}} + +acl_check_rcpt: + + ... + + defer + condition = GREYLISTED + condition = ${if <{$message_size}{1M}} + log_message = grey listed exigrey + diff -r 8525154c1389 -r 4a17eef44b7c bin/exigrey --- a/bin/exigrey Wed Jun 01 00:54:05 2016 +0200 +++ b/bin/exigrey Wed Jun 01 01:09:04 2016 +0200 @@ -2,24 +2,6 @@ # © 2006,2007,2016 Heiko Schlittermann # Quick and dirty. Absolutly no warranty. Not even for spelling ;-) -use constant USAGE => <<'#'; - -Usage: !ME! --insert item [delay [db]] # insert an item - !ME! --remove item # remove an item - !ME! --list [db] # list all items - !ME! --stat [db* ...] # print short statistic - !ME! --clean [days [db* ...]] # remove items not used since days - !ME! --purge [days [db* ...]] # remove items older than days - !ME! --dbs [db* ...] # list data base(s) - - db -- single name of database - db* -- glob pattern of database - - If the data base name doesn't doesn't start with "./" or "/" - it is considered to be realtiv to exim_spool_dir/grey/. - -# - use strict; use warnings; use Getopt::Long; @@ -29,6 +11,7 @@ use FindBin qw/$Bin/; use POSIX qw/strftime mktime/; use if $ENV{DEBUG} => 'Smart::Comments'; +use Pod::Usage; use Exim::Grey qw(:all); @@ -49,21 +32,17 @@ MAIN: { GetOptions( - "list!" => \$opt_list, - "insert!" => \$opt_insert, - "remove!" => \$opt_remove, - "stats!" => \$opt_stats, - "clean!" => \$opt_clean, - "purge!" => \$opt_purge, - "dbs!" => \$opt_dbs, - "help!" => \$opt_help, - ) or die ME . ": Bad usage, try " . ME . " --help.\n"; - - if ($opt_help) { - ($_ = USAGE) =~ s/!(.*?)!/eval $1/eg; - print; - exit 0; - } + 'list!' => \$opt_list, + 'insert!' => \$opt_insert, + 'remove!' => \$opt_remove, + 'stats!' => \$opt_stats, + 'clean!' => \$opt_clean, + 'purge!' => \$opt_purge, + 'dbs!' => \$opt_dbs, + 'help!' => sub { pod2usage(-verbose => 1, -exit => 0) }, + 'man!' => sub { pod2usage(-verbose => 2, -exit => 0, + noperldoc => system('perldoc -V 2>/dev/null >/dev/null')) }, + ) or pod2usage; if ($opt_list) { foreach (@ARGV = getDBs(@ARGV)) { @@ -210,4 +189,66 @@ } } +__END__ + +=head1 NAME + + exigrey - command line interface to exim greylist database + +=head1 SYNOPSIS + + exigrey --insert item [delay [db]] + exigrey --remove item + exigrey --list [db] + exigrey --stat [db-glob ...] + exigrey {--clean|--purge} [days [db-glob ...]] + exigrey {--man|--help} + +=head1 DESCRIPTION + +B is the command line interface to the greylist implementation +for Exim. It may be used to examine, cleanup and manipulate the +greylist database. + +=head1 OPTIONS + +=over + +=item B<--insert> I [I [I]] + +Insert a new item into the database. + +=item B<--remove> I [I] + +Remove the Item I from the database I. + +=item B<--list> [I] + +List the complete content of the database I. This +may take a while. + +=item B<--stat> [I] + +Print the statistics about the databases matching the I +pattern. + +=item B<--clean>|B<--purge> [I [I]...] + +Clean (unused) items or purge items unconditionally. + +=item B<--dbs> [I] + +List the matching database names. + +=back + +If a database name starts with F<./> or F, it's considered +a file name, otherwise it's looked for in F. + +=head1 AUTHOR + +Heiko Schlittermann L<> + +=cut + # vim:ft=perl aw sts=4 sw=4: diff -r 8525154c1389 -r 4a17eef44b7c exim.conf.ex --- a/exim.conf.ex Wed Jun 01 00:54:05 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -###################################################################### -# MAIN CONFIGURATION SETTINGS # -###################################################################### -... - -perl_startup = use Exim::Grey qw(unseen); -GREYLISTED = ${perl{unseen}{<$sender_address>:<$local_part@$domain>/$sender_host_address}{60}} - -acl_check_rcpt: - - ... - - defer - condition = GREYLISTED - condition = ${if <{$message_size}{1M}} - log_message = grey listed exigrey -