here is the latest version, with all of the great changes that have been suggested; thanks so much to everyone for your help!

: # -*- perl -*- eval "exec perl -S $0 $*" if $running_under_some_shell; #===================================================================== # errreporter - mails interesting entries from the AIX error log #===================================================================== use strict; use File::Basename; use Getopt::Std; # declare vars in the conf file ... my ($email, @ignore); # declare some other vars used below ... my ($identifier, $timestamp, $resource, $description, @error); my $me = basename($0); chomp (my $hostname = `/usr/bin/hostname`); my @usage_string = <<ENDOFUSAGESTRING; Usage: $me [-hul] [-f file] Run "$me -h" for additional information. ENDOFUSAGESTRING my %opts; getopts('hulf:', \%opts) or die @usage_string; if ($opts{h} || $opts{u}) { exec "perldoc $0" }; if ($opts{l}) { exec '/usr/bin/errpt', '-t' or die "$me: couldn't exec 'errpt -t'\n +" }; my $conf = $opts{f} || "/etc/errreporter.conf"; eval `/usr/bin/cat $conf 2> /dev/null` or die "$me: couldn't read specified conf file $conf\n"; unless (defined ($email)) { die "$me: email not defined " } # add the errpt header line to the ignore list ... push (@ignore, "IDENTIFIER"); # get the current time, in the form used by the errpt command ... my $starttime = sprintf '%02d%02d%02d%02d%02d', sub { $_[4]+1, $_[3], $_[2], $_[1], $_[5] % 100 } -> (localtime); print STDOUT "$me: starting errreporter at $starttime, using conf file + $conf.\n"; # open an errpt process, reading the summary of errors posted # after the start time of this script ... open (ERRPT, "/usr/bin/errpt -c -s $starttime |") or die "$me: couldn't open errpt for reading!\n"; # while the above process is open ... while (<ERRPT>) { chomp; # split the errpt entry into fields ... ($identifier, $timestamp, undef, undef, $resource, $description) = split (/\s+/, $_, 6); my $ignore = 'no'; foreach (@ignore) { # check to see if the entry is on the ignore list ... if ($identifier =~ /$_/) { $ignore = 'yes' ; last } }; unless ($ignore eq 'yes') { # store the full entry in the array @error ... @error = `/usr/bin/errpt -a -s $timestamp`; # add a subject line to the @error array ... unshift (@error, "Subject: $hostname -- $resource -- $descript +ion\n"); # and send the e-mail ... open (SENDMAIL, "|/usr/sbin/sendmail $email") or die "$me: couldn't open sendmail: $!"; print SENDMAIL @error; close (SENDMAIL); }; }; #===================================================================== =pod =head1 NAME ... cut out the pod, which hasn't changed ... =cut


In reply to Re: stop me from embarrassing myself by blueflashlight
in thread stop me from embarrassing myself by blueflashlight

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.