2011/04/12 12:50:24|red|florida 2011/04/12 15:20:21|green|tampa 2011/04/12 15:30:12|red|miami #### #!/usr/dist/share/perl,v5.003/5bin.sun4/perl use Time::Local; $today = timelocal(localtime); $mailprog = "|/usr/sbin/sendmail -t"; $lst_email = 'someone@outthere.com'; open (DATA,"/mylist.log") || die ("Can't Open data File: $!\n"); @data=; foreach $line (@data) { ($datestamp, $status, $location)=split(/\|/,$line); my $lastaction = &date_to_unix($datestamp); if (($today > ($lastaction - 216000)) && ($db =~ 'red') ) { MAILIT close DATA; sub date_to_unix() { my ($year,$mon,$day,$hour,$min,$sec) = $_[0] =~ /(\d+)\/(\d+)\/(\d+)\s(\d+):(\d+):(\d+)/; return undef unless ($day and $mon and $year); return timelocal(0,$min,$hour,$day,$mon-1,$year-1900); } open (MAILIT, "$mailprog") || &cgierr("Can't start mail program"); print MAILIT "To: $lst_email\n"; print MAILIT "Subject: $location is stuck \n\n"; print MAILIT "$location light has been red for more than an hour \n\n"; print MAILIT "please check it. \n\n"; print MAILIT "Here are the info\n"; print MAILIT "$datestamp and $location"; close (MAILIT);