⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmuegel

📁 < linux网络编程工具>>配套源码
💻
📖 第 1 页 / 共 5 页
字号:
have data files and no control files or vice versa.
.IP \fB-d\fR
Print a detailed report of mail messages that have been queued longer than
the specified or default time. Information that is presented includes:
.RS
.RS
.IB
Sendmail queue identifier.
.IB
Date the message was first queued.
.IB
Sender of the message.
.IB
One or more recipients of the message.
.IB
An optional status of the message. This usually indicates why the message
has not been delivered.
.RE
.RE
.IP \fB-m\fR 14
Mail off the results if any problems were found.
Normaly results are printed to stdout. If this option
is specified they are mailed to one or more users. Results
are not printed to stdout in this case. Results are \fBonly\fR
mailed if \*(mp found something wrong.
.IP "\fB-q\fR \fIqueue-dir\fI"
The sendmail mail queue directory. Default is \fB/usr/spool/mqueue\fR or
some other site configured value.
.IP "\fB-t\fR \fItime\fR"
List messages that have been in the queue longer than
\fItime\fR. Time should of the form:
.sp 1
.RS
.RS
(<number>(s|m|h|d))+
.sp 1
.RE
.RE
.RS 14
The second portion of the above definition
specifies seconds, minutes, hours, or
days, respectfully. The first portion is the number of
those units. There can be any number of such specifiers.
As an example, 1h30m means 1 hour and 30 minutes.
.sp 1
The default is 2 hours.
.RE
.IP \fB-s\fR 14
Print a summary of messages that have been queued longer than
the specified or default time. Two separate types of summaries are printed.
The first summarizes the queue messages by destination host. The host name
is gleaned from the recipient addresses for each message.
Thus the actual host names for this summary should be taken with a grain
of salt since ruleset 0 has not been applied to the address the host was
taken from nor were MX records consulted. It would be possible to add
this; however, the execution time of the script would increase 
dramatically. The second summary is by status message.
.IP "\fB-u\fR \fIusers\fR"
Specify list of users to send a mail report to other than
the invoker. This option is only valid when \fB-m\fR has been
specified. Multiple recipients may be separated by spaces.
.IP "\fB-w\fR \fIwidth\fR"
Specify the page width to which the output should tailored. \fIwidth\fR
should be an integer representing some character position. The default is
80 or some other site configured value. Output is folded neatly to match 
\fIwidth\fR.
.SH EXAMPLES
.nf
% \fBdate\fR
Tue Jan 19 12:07:20 CST 1993
X
% \fBcqueue -t 21h45m -w 70\fR
X
Summary of messages in queue longer than 21:45:00 by destination 
host:
X
X   Number of
X   Messages    Destination Host
X   ---------   ----------------
X   2           cigseg.rtsg.mot.com
X   1           mnesouth.corp.mot.com
X   ---------
X   3
X
Summary of messages in queue longer than 21:45:00 by status message:
X
X   Number of
X   Messages    Status Message
X   ---------   --------------
X   1           Deferred: Connection refused by mnesouth.corp.mot.com
X   2           Deferred: Host Name Lookup Failure
X   ---------
X   3
X
Detail of messages in queue longer than 21:45:00 sorted by creation 
date:
X
X   ID:        AA20573
X   Date:      02:09:27 PM 01/18/93
X   Sender:    melrose-place-owner@ferkel.ucsb.edu
X   Recipient: pbaker@cigseg.rtsg.mot.com
X   Status:    Deferred: Host Name Lookup Failure
X
X   ID:        AA20757
X   Date:      02:11:30 PM 01/18/93
X   Sender:    90210-owner@ferkel.ucsb.edu
X   Recipient: pbaker@cigseg.rtsg.mot.com
X   Status:    Deferred: Host Name Lookup Failure
X
X   ID:        AA21110
X   Date:      02:17:01 PM 01/18/93
X   Sender:    rd_lap_wg@mdd.comm.mot.com
X   Recipient: jim_mathis@mnesouth.corp.mot.com
X   Status:    Deferred: Connection refused by mnesouth.corp.mot.com
.fi
.SH AUTHOR
.nf
Michael S. Muegel (mmuegel@mot.com)
UNIX Applications Startup Group
Corporate Information Office, Schaumburg, IL
Motorola, Inc.
.fi
.SH COPYRIGHT NOTICE
Copyright 1993, Motorola, Inc.
.sp 1
Permission to use, copy, modify and distribute without charge this
software, documentation, etc. is granted, provided that this
comment and the author's name is retained.  The author nor Motorola assume any
responsibility for problems resulting from the use of this software.
.SH SEE ALSO
.nf
\fBsendmail(8)\fR
\fISendmail Installation and Operation Guide\fR.
.fi
SHAR_EOF
chmod 0444 man/cqueue.1 ||
echo 'restore of man/cqueue.1 failed'
Wc_c="`wc -c < 'man/cqueue.1'`"
test 5212 -eq "$Wc_c" ||
	echo 'man/cqueue.1: original size 5212, current size' "$Wc_c"
fi
# ============= man/postclip.1 ==============
if test -f 'man/postclip.1' -a X"$1" != X"-c"; then
	echo 'x - skipping man/postclip.1 (File already exists)'
else
echo 'x - extracting man/postclip.1 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'man/postclip.1' &&
.TH POSTCLIP 1L
\"
\" mmuegel
\" /usr/local/ustart/src/mail-tools/dist/foo/man/postclip.1,v 1.1 1993/07/28 08:08:25 mmuegel Exp
\"
.ds mp \fBpostclip\fR
.SH NAME
\*(mp - send only the headers to Postmaster
.SH SYNOPSIS
\*(mp [ \fB-v\fR ] [ \fIto\fR ... ]
.SH DESCRIPTION
\*(mp  will forward non-delivery reports to a postmaster after deleting the body
of the message. This keeps bounced mail private and helps to avoid disk space problems. \*(mp tries its best to keep as much of the header trail as possible.
Hopefully only the original body of the message will be filtered. Only messages
that have a subject that begins with 'Returned mail:' are filtered. This
ensures that other mail is not accidently mucked with. Finally, note that
\fBsendmail\fR is used to deliver the message after it has been (possibly)
filtered. All of the original headers will remain intact.
.sp 1 
You can use this with any \fBsendmail\fR by modifying the Postmaster alias.
If you use IDA \fBsendmail\fR you could add the following to <machine>.m4:
.sp 1
.RS
define(POSTMASTERBOUNCE, mailer-errors)
.RE
.sp 1
In the aliases file, add a line similar to the following:
.sp 1
.RS
mailer-errors: "|/usr/local/bin/postclip postmaster"
.RE
.SH OPTIONS
.IP \fB-v\fR
Be verbose about delivery. Probably only useful when debugging \*(mp.
.IP \fIto\fR
A list of one or more e-mail ids to send the modified
Postmaster messages to. If none are specified postmaster
is used.
.SH AUTHOR
.nf
Michael S. Muegel (mmuegel@mot.com)
UNIX Applications Startup Group
Corporate Information Office, Schaumburg, IL
Motorola, Inc.
.fi
.SH CREDITS
The original idea to filter Postmaster mail was taken from a script by 
Christopher Davis <ckd@eff.org>.
.SH COPYRIGHT NOTICE
Copyright 1992, Motorola, Inc.
.sp 1
Permission to use, copy, modify and distribute without charge this
software, documentation, etc. is granted, provided that this
comment and the author's name is retained.  The author nor Motorola assume any
responsibility for problems resulting from the use of this software.
.SH SEE ALSO
.nf
\fBsendmail(8)\fR
.fi
SHAR_EOF
chmod 0444 man/postclip.1 ||
echo 'restore of man/postclip.1 failed'
Wc_c="`wc -c < 'man/postclip.1'`"
test 2078 -eq "$Wc_c" ||
	echo 'man/postclip.1: original size 2078, current size' "$Wc_c"
fi
# ============= src/cqueue ==============
if test ! -d 'src'; then
    echo 'x - creating directory src'
    mkdir 'src'
fi
if test -f 'src/cqueue' -a X"$1" != X"-c"; then
	echo 'x - skipping src/cqueue (File already exists)'
else
echo 'x - extracting src/cqueue (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'src/cqueue' &&
#!/usr/local/ustart/bin/suidperl
X
# NAME
#    cqueue - check sendmail queue for problems
#
# SYNOPSIS
#    Type cqueue -usage
#
# AUTHOR
#    Michael S. Muegel <mmuegel@mot.com>
#
# RCS INFORMATION
#    mmuegel
#    /usr/local/ustart/src/mail-tools/dist/foo/src/cqueue,v 1.1 1993/07/28 08:09:02 mmuegel Exp
X
# So that date.pl does not yell (Domain/OS version does a ``)
$ENV{'PATH'}    = "";
X
# A better getopts routine
require "newgetopts.pl";
require "timespec.pl";
require "mail.pl";
require "date.pl";
require "mqueue.pl";
require "strings1.pl";
require "elapsed.pl";
X
($Script_Name = $0) =~ s/.*\///;
X         
# Some defaults you may want to change
$DEF_TIME	= "2h";
$DEF_QUEUE      = "/usr/spool/mqueue";
$DEF_COLUMNS	= 80;
$DATE_FORMAT    = "%r %D";
X
# Constants that probably should not be changed
$USAGE          = "Usage: $Script_Name [ -abdms ] [ -q queue-dir ] [ -t time ] [ -u user ] [ -w width ]\n";
$VERSION        = "${Script_Name} by mmuegel; 1.1 of 1993/07/28 08:09:02";
$SWITCHES       = "abdmst:u:q:w:";
$SPLIT_EXPR	= '\s,\.@!%:';
$ADDR_PART_EXPR	= '[^!@%]+';
X
# Let getopts parse for switches
$Status = &New_Getopts ($SWITCHES, $USAGE);
exit (0) if ($Status == -1);
exit (1) if (! $Status);
X
# Check args 
die "${Script_Name}: -u only valid with -m\n" if (($opt_u) && (! $opt_m));
die "${Script_Name}: -a not valid with -t option\n" if ($opt_a && $opt_t);
$opt_u = getlogin || (getpwuid ($<))[0] || $ENV{"USER"} || die "${Script_Name}: can not determine who you are!\n" if (! $opt_u);
X
# Set defaults
$opt_t = "0s" if ($opt_a);
$opt_t = $DEF_TIME if ($opt_t eq "");
$opt_w = $DEF_COLUMNS if ($opt_w eq "");
$opt_q = $DEF_QUEUE if ($opt_q eq "");
$opt_s = $opt_d = 1 if (! ($opt_s || $opt_d));
X
# Untaint the users to mail to
$opt_u =~ /^(.*)$/;
$Users = $1;
X
# Convert time option to seconds and seconds to elapsed form
die "${Script_Name}: $Msg\n" if (! (($Status, $Msg, $Seconds) = &Time_Spec_To_Seconds ($opt_t))[0]);
$Elapsed = &Seconds_To_Elapsed ($Seconds, 1);
$Time_Info = " longer than $Elapsed" if ($Seconds);
X
# Get the current time
$Current_Time = time;
$Current_Date = &date ($Current_Time, $DATE_FORMAT);
X
($Status, $Msg, @Queue_IDs) = &Get_Queue_IDs ($opt_q, 1, @Missing_Control_IDs,
X   @Missing_Data_IDs);
die "$Script_Name: $Msg\n" if (! $Status);
X
# Yell about missing data/control files?
if ($opt_b)
{
X
X   $Report = "\nMessages missing control files:\n\n   " . 
X             join ("\n   ", @Missing_Control_IDs) . 
X             "\n" 
X      if (@Missing_Control_IDs);
X
X   $Report .= "\nMessages missing data files:\n\n   " . 
X              join ("\n   ", @Missing_Data_IDs) . 
X              "\n"
X      if (@Missing_Data_IDs);
};
X
# See if any mail messages are older than $Seconds
foreach $Queue_ID (@Queue_IDs)
{
X   # Get lots of info about this sendmail message via the control file
X   ($Status, $Msg) = &Parse_Control_File ($opt_q, $Queue_ID, *Sender, 
X      *Recipients, *Errors_To, *Creation_Time, *Priority, *Status_Message, 
X      *Headers);
X   next if ($Status == -1);
X   if (! $Status)
X   {
X      warn "$Script_Name: $Queue_ID: $Msg\n";
X      next;
X   };
X
X   # Report on message if it is older than $Seconds
X   if ($Current_Time - $Creation_Time >= $Seconds)
X   {
X      # Build summary by host information. Keep track of each host destination
X      # encountered.
X      if ($opt_s)
X      {
X         %Host_Map = ();
X         foreach (@Recipients)
X         {
X	    if ((/@($ADDR_PART_EXPR)$/) || (/($ADDR_PART_EXPR)!$ADDR_PART_EXPR$/))
X            {
X	       ($Host = $1) =~ tr/A-Z/a-z/;
X               $Host_Map {$Host} = 1;
X	    }
X	    else
X	    {
X	       warn "$Script_Name: could not find host part from $_; contact author\n";
X	    };
X         };
X
X         # For each unique target host add to its stats
X         grep ($Host_Queued {$_}++, keys (%Host_Map));
X
X         # Build summary by message information.
X         $Message_Queued {$Status_Message}++ if ($Status_Message);
X      };
X
X      # Build long report information for this creation time (there may be
X      # more than one message created at the same time)
X      if ($opt_d)
X      {
X         $Creation_Date = &date ($Creation_Time, $DATE_FORMAT);
X         $Recipient_Info = &Format_Text_Block (join (", ", @Recipients), 
X	    "   Recipient: ", 1, 0, $opt_w, $SPLIT_EXPR);
X         $Time_To_Report {$Creation_Time} .= <<"EOS";
X
X   ID:        $Queue_ID
X   Date:      $Creation_Date
X   Sender:    $Sender
$Recipient_Info
EOS
X
X         # Add the status message if available to long report
X         if ($Status_Message)
X         {
X	    $Time_To_Report {$Creation_Time} .= &Format_Text_Block ($Status_Message, 
X   	       "   S

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -