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

📄 mmuegel

📁 早期freebsd实现
💻
📖 第 1 页 / 共 5 页
字号:
80 or some other site configured value. Output is folded neatly to match \fIwidth\fR..SH EXAMPLES.nf% \fBdate\fRTue Jan 19 12:07:20 CST 1993X% \fBcqueue -t 21h45m -w 70\fRXSummary of messages in queue longer than 21:45:00 by destination host:XX   Number ofX   Messages    Destination HostX   ---------   ----------------X   2           cigseg.rtsg.mot.comX   1           mnesouth.corp.mot.comX   ---------X   3XSummary of messages in queue longer than 21:45:00 by status message:XX   Number ofX   Messages    Status MessageX   ---------   --------------X   1           Deferred: Connection refused by mnesouth.corp.mot.comX   2           Deferred: Host Name Lookup FailureX   ---------X   3XDetail of messages in queue longer than 21:45:00 sorted by creation date:XX   ID:        AA20573X   Date:      02:09:27 PM 01/18/93X   Sender:    melrose-place-owner@ferkel.ucsb.eduX   Recipient: pbaker@cigseg.rtsg.mot.comX   Status:    Deferred: Host Name Lookup FailureXX   ID:        AA20757X   Date:      02:11:30 PM 01/18/93X   Sender:    90210-owner@ferkel.ucsb.eduX   Recipient: pbaker@cigseg.rtsg.mot.comX   Status:    Deferred: Host Name Lookup FailureXX   ID:        AA21110X   Date:      02:17:01 PM 01/18/93X   Sender:    rd_lap_wg@mdd.comm.mot.comX   Recipient: jim_mathis@mnesouth.corp.mot.comX   Status:    Deferred: Connection refused by mnesouth.corp.mot.com.fi.SH AUTHOR.nfMichael S. Muegel (mmuegel@mot.com)UNIX Applications Startup GroupCorporate Information Office, Schaumburg, ILMotorola, Inc..fi.SH COPYRIGHT NOTICECopyright 1993, Motorola, Inc..sp 1Permission to use, copy, modify and distribute without charge thissoftware, documentation, etc. is granted, provided that thiscomment and the author's name is retained.  The author nor Motorola assume anyresponsibility for problems resulting from the use of this software..SH SEE ALSO.nf\fBsendmail(8)\fR\fISendmail Installation and Operation Guide\fR..fiSHAR_EOFchmod 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)'elseecho '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 bodyof 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 messagesthat have a subject that begins with 'Returned mail:' are filtered. Thisensures 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.RSdefine(POSTMASTERBOUNCE, mailer-errors).RE.sp 1In the aliases file, add a line similar to the following:.sp 1.RSmailer-errors: "|/usr/local/bin/postclip postmaster".RE.SH OPTIONS.IP \fB-v\fRBe verbose about delivery. Probably only useful when debugging \*(mp..IP \fIto\fRA list of one or more e-mail ids to send the modifiedPostmaster messages to. If none are specified postmasteris used..SH AUTHOR.nfMichael S. Muegel (mmuegel@mot.com)UNIX Applications Startup GroupCorporate Information Office, Schaumburg, ILMotorola, Inc..fi.SH CREDITSThe original idea to filter Postmaster mail was taken from a script by Christopher Davis <ckd@eff.org>..SH COPYRIGHT NOTICECopyright 1992, Motorola, Inc..sp 1Permission to use, copy, modify and distribute without charge thissoftware, documentation, etc. is granted, provided that thiscomment and the author's name is retained.  The author nor Motorola assume anyresponsibility for problems resulting from the use of this software..SH SEE ALSO.nf\fBsendmail(8)\fR.fiSHAR_EOFchmod 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'fiif test -f 'src/cqueue' -a X"$1" != X"-c"; then	echo 'x - skipping src/cqueue (File already exists)'elseecho 'x - extracting src/cqueue (Text)'sed 's/^X//' << 'SHAR_EOF' > 'src/cqueue' &&#!/usr/local/ustart/bin/suidperlX# 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 ExpX# So that date.pl does not yell (Domain/OS version does a ``)$ENV{'PATH'}    = "";X# A better getopts routinerequire "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 formdie "${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){XX   $Report = "\nMessages missing control files:\n\n   " . X             join ("\n   ", @Missing_Control_IDs) . X             "\n" X      if (@Missing_Control_IDs);XX   $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 $Secondsforeach $Queue_ID (@Queue_IDs){X   # Get lots of info about this sendmail message via the control fileX   ($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   };XX   # Report on message if it is older than $SecondsX   if ($Current_Time - $Creation_Time >= $Seconds)X   {X      # Build summary by host information. Keep track of each host destinationX      # 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	    elseX	    {X	       warn "$Script_Name: could not find host part from $_; contact author\n";X	    };X         };XX         # For each unique target host add to its statsX         grep ($Host_Queued {$_}++, keys (%Host_Map));XX         # Build summary by message information.X         $Message_Queued {$Status_Message}++ if ($Status_Message);X      };XX      # Build long report information for this creation time (there may beX      # 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";XX   ID:        $Queue_IDX   Date:      $Creation_DateX   Sender:    $Sender$Recipient_InfoEOSXX         # Add the status message if available to long reportX         if ($Status_Message)X         {X	    $Time_To_Report {$Creation_Time} .= &Format_Text_Block ($Status_Message, X   	       "   Status:    ", 1, 0, $opt_w, $SPLIT_EXPR) . "\n";X         };X      };X   };X};X# Add the summary report by target host?if ($opt_s){X   foreach $Host (sort (keys (%Host_Queued)))X   {X      $Host_Report .= &Format_Text_Block ($Host, X         sprintf ("   %-9d   ", $Host_Queued{$Host}), 1, 0, $opt_w,X         $SPLIT_EXPR) . "\n";X      $Num_Hosts += $Host_Queued{$Host};X   };X   if ($Host_Report)X   {X      chop ($Host_Report);X      $Report .= &Format_Text_Block("\nSummary of messages in queue$Time_Info by destination host:\n", "", 0, 0, $opt_w);XX      $Report .= <<"EOS";XX   Number ofX   Messages    Destination HostX   ---------   ----------------$Host_ReportX   ---------X   $Num_HostsEOSX   };};X# Add the summary by message report?if ($opt_s){X   foreach $Message (sort (keys (%Message_Queued)))X   {X      $Message_Report .= &Format_Text_Block ($Message, X         sprintf ("   %-9d   ", $Message_Queued{$Message}), 1, 0, $opt_w, X         $SPLIT_EXPR) . "\n";X      $Num_Messages += $Message_Queued{$Message};X   };X   if ($Message_Report)X   {X      chop ($Message_Report);X      $Report .= &Format_Text_Block ("\nSummary of messages in queue$Time_Info by status message:\n", "", 0, 0, $opt_w);XX      $Report .= <<"EOS";XX   Number ofX   Messages    Status MessageX   ---------   --------------$Message_ReportX   ---------X   $Num_MessagesEOSX   };};X# Add the detailed message reports?if ($opt_d){X   foreach $Time (sort { $a <=> $b} (keys (%Time_To_Report)))X   {X      $Report .= &Format_Text_Block ("\nDetail of messages in queue$Time_Info sorted by creation date:\n","", 0, 0, $opt_w) if (! $Detailed_Header++);X      $Report .= $Time_To_Report {$Time};X   };};X# Now mail or print the reportif ($Report){X   $Report .= "\n";X   if ($opt_m)X   {X      ($Status, $Msg) = &Send_Mail ($Us

⌨️ 快捷键说明

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