dru145 has asked for the wisdom of the Perl Monks concerning the following question:
Below is the script that I wrote that I thought would work, but it doesn't seem to be. Also, when the fw log -n is run is there a way to stop the process so that it doesn't stay open scrolling through the whole log file (by default this command will stay open showing all new log entries). I want to run this command every 30 minutes from cron and I don't want a bunch of these processes running in the background. Will this work: fw log |exit 1lvfile_open: failed to open logfile /etc/fw/log/fw.log log ptrs proble +m Failed to open logfile
TIA#!/usr/bin/perl -w use strict; ############################################################ # # Script to check to see if the log files become corrupt # ############################################################ my $result; my $cmd1="fw log -n" ; my $from_addr="Root<root\@mysite.com>"; my $to_addr="Dru<dru\@mysite.com>"; #Run fw log command #$result=`$cmd1`; #If it fails, then send email if ($cmd1 =~ m/failed/){ open(SENDMAIL, "|/usr/lib/sendmail -oi -t") or die "Can't fork for sendmail: $!\n"; print SENDMAIL <<EOM; From: $from_addr To: $to_addr Subject: There is a problem with the firewall logs! EOM close(SENDMAIL) or warn "sendmail didn't close nicely"; exit 1 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mail me when Firewall Log Files Become Corrupt.
by VSarkiss (Monsignor) on Aug 31, 2001 at 03:54 UTC | |
|
Re: Mail me when Firewall Log Files Become Corrupt.
by Beatnik (Parson) on Aug 31, 2001 at 00:55 UTC |