# HG changeset patch # User heiko # Date 1167816081 0 # Node ID bce276394054e15d0d5252a8e5af04780a08a263 # Parent 91803f1e27410decfc04aaea6cca4c27dc75aca1 Some options added. diff -r 91803f1e2741 -r bce276394054 exigrey.pl --- a/exigrey.pl Wed Jan 03 08:55:02 2007 +0000 +++ b/exigrey.pl Wed Jan 03 09:21:21 2007 +0000 @@ -6,10 +6,11 @@ use constant USAGE => <<'#'; -Usage: !ME! item [delay [db]] - !ME! --list [db] - !ME! --stat [db] - !ME! --clean [days [db]] +Usage: !ME! --insert item [delay [db]] # insert 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! --dbs # list dbm files in default directory Defaults: delay: !$DEFAULT{delay}! db: !$DEFAULT{db}! @@ -33,8 +34,10 @@ my $opt_list; my $opt_stats; +my $opt_insert; my $opt_help; my $opt_clean; +my $opt_dbs; sub iterate(\%$); @@ -42,8 +45,10 @@ GetOptions( "list!" => \$opt_list, + "insert!" => \$opt_insert, "stats!" => \$opt_stats, "clean!" => \$opt_clean, + "dbs!" => \$opt_dbs, "help!" => \$opt_help, ) or die ME.": Bad usage, try ".ME." --help.\n"; @@ -120,7 +125,15 @@ exit 0; } - print unseen(@ARGV, 10) . "\n"; + if ($opt_dbs) { + print join("\n", glob(getDBDir() . "/*")), "\n"; + exit 0; + } + + if ($opt_insert) { + print unseen(@ARGV); + exit 0; + } } # Helper to iterate over our hash and call the passed diff -r 91803f1e2741 -r bce276394054 exim-exigrey.pl --- a/exim-exigrey.pl Wed Jan 03 08:55:02 2007 +0000 +++ b/exim-exigrey.pl Wed Jan 03 09:21:21 2007 +0000 @@ -104,10 +104,12 @@ # this file if (!-f $db) { (my $dir = $db) =~ s/^(.*)\/.*?$/$1/; + # copy mode, uid, gid from the directory my ($mode, $user, $group) = (stat $dir)[2,4,5] or die "Can't stat $dir: $!"; my $umask = umask(($mode & 0777) ^ 0777); - local ($>, $)) = ($user, $group); + local $) = $group; + local $> = $user; open(X, ">>$db") or die "Can't create $db: $!"; close(X); umask $umask;