#!/usr/bin/perl

#######################################################################
#
# runtime_status.pl
#
# Takes 30 day average start and stop time data for NCEP production
# jobs a creates various HTML documents for the web.
#
#######################################################################

$COMOUT = $ENV{'COMOUT'};
$COMOUTruntime = $ENV{'COMOUTruntime'};
$PDY = $ENV{'PDY'};
$PDYm1 = $ENV{'PDYm1'};
$RUNTFIX = $ENV{'FIXrun'};
$interProcDir = $ENV{COMOUTinter};

chop($TIME = `date -u +"%H:%M:%S"`);
chop($TIME_est = `date +"%H:%M %Z"`);
chop($DATE = `date -u +"%d %b %Y  %H:%M GMT"`);
chop($HOUR = `date -u +%H`);

$ave30day = "$COMOUT/ave30/ave30day.short";
$status_file = "$COMOUT/ave30/production_status";
$status_html = "$COMOUT/ave30/production_status.html";
$statusfix = "$RUNTFIX/runtime_status";
$target_time_file= "$RUNTFIX/runtime_target_times";
$completed_file = "$COMOUTruntime/$PDY.log";
$completed_filem1 = "$COMOUTruntime/$PDYm1.log";
# JY $running_file = "$COMOUT/interProcess/limbo.hold";
$running_file = "$interProcDir/limbo.hold";
# $canceled_file = "/com/logs/canceled.jobs";
$canceled_file = "$COMOUT/canceled.jobs";

$job_search = "/cgi-bin/nwprod/product_stat.pl?jobname=";

#
# Define subroutines
#
sub time2sec ($) {
   my $tm = shift;
   ($hour,$min,$sec)=split(/\:/,$tm);
   $seconds=($hour*3600)+($min*60)+$sec;
   return $seconds;
}

sub sec2time ($) {
   my $tm = shift;

   if($tm >= 86400)
      {
       $hour=int (($tm-86400)/3600);
       $min=int (($tm-86400-$hour*3600)/60);
       $sec=int($tm-86400-($hour*3600)-($min*60));
      }
   else
      {
       $hour=int $tm/3600;
       $min=int (($tm-$hour*3600)/60);
       $sec=int($tm-($hour*3600)-($min*60));
      }
   if($hour < 10){$hour="0$hour"};
   if($min < 10){$min="0$min"};
   if($sec < 10){$sec="0$sec"};
   $timestring="$hour:$min:$sec";
   return $timestring;
}

#
# Define all hash tables
#
%a30start = ();
%a30stop = ();
%a30start_sec = ();
%a30stop_sec = ();
%target_time = ();
%job30 = ();
%complete = ();
%comp_time = ();
%completem1 = ();
%compm1_time = ();
%running = ();
%start_time = ();

#
# Read in 30 day averages into hash tables
#
open( STATS, "$ave30day" );
while ( <STATS> ) {
    chop;
    #
    # Parse line using whitespace as delimiter
    #
    ( $jid, $avestart, $avestop ) = split( /\s+/ );

    $job30{$jid} = $jid;
    $a30start{$jid} = sec2time($avestart * 60);
    $a30stop{$jid} = sec2time($avestop * 60);
    $a30start_sec{$jid} = $avestart * 60;
    $a30stop_sec{$jid} = $avestop * 60;
}
close STATS;

#
# Read in target times into hash tables
#
open( STATS, "$target_time_file" );
while ( <STATS> ) {
    chop;
    #
    # Parse line using whitespace as delimiter
    #
    ( $jid, $target_ti ) = split( /\|/ );
    
    $target_time{$jid} = $target_ti;
}
close STATS;

#
# Read in the completed jobs for PDY
#
open( STATS, "$completed_file" );
while ( <STATS> ) {
    chop;
    #    
    # Parse line using whitespace as delimiter
    #
    ( $jid, $startdate, $starttime, $stopdate, $stoptime ) = split( /\s+/ );
    
    $complete{$jid} = $jid;
    $comp_time{$jid} = $stoptime;
    $comp_start_time{$jid} = $starttime;
}
close STATS;

#
# Read in the completed jobs for PDYm1
#
open( STATS, "$completed_filem1" );
while ( <STATS> ) {
    chop;
    #    
    # Parse line using whitespace as delimiter
    #
    ( $jid, $startdate, $starttime, $stopdate, $stoptime ) = split( /\s+/ );
    
    $completem1{$jid} = $jid;
    $compm1_time{$jid} = $stoptime;
}
close STATS;

#
# Read in the running jobs
#
open( STATS, "$running_file" );
while ( <STATS> ) {
    chop;
    #    
    # Parse line using whitespace as delimiter
    #
    ( $jid, $startdate, $starttime ) = split( /\s+/ );

    $running{$jid} = $jid;
    $start_time{$jid} = $starttime;
}
close STATS;

#
# Read in the canceled jobs
#
$canceled = "NULL";
open( STATS, "$canceled_file" );
while ( <STATS> ) {
    chop;
    #    
    # Parse line using whitespace as delimiter
    #
    ( $pdy, $jid ) = split( /\s+/ );

    if ( $pdy eq $PDY ) { $canceled = "$canceled|$jid"; }
}
close STATS;

#
# Create CURRENT PRODUCTION STATUS web page.
#
open( TEXT, ">$status_file" );
open( HTML, ">$status_html" );
select ( HTML );
print "<HTML>\n";
print "<HEAD>\n";
print "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"150 ; URL=index.html#TARGET\">\n";
print "<meta http-equiv=\"pragma\" content=\"no-cache\">\n";
print "<meta http-equiv=\"Expires\" content=\"Fri, 08 Dec 2000 120000 GMT\">\n";
print "</head> \n";
print "<TITLE> Current Status of NCEP Model Production </TITLE>\n";
print "<body text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#0000EE\" vlink=\"#551A8B\" alink=\"#FF0000\">\n";
print "<CENTER><IMG SRC=\"pics/ncep_80.gif\"><br><br>\n";
print "<h2>CURRENT STATUS OF THE NCEP PRODUCTION SUITE\n";
###BAG print "<h2>CURRENT STATUS OF THE NCEP PARALLEL PRODUCTION SUITE\n";
print "<br>AT $DATE ($TIME_est)<br><\h2>\n";
print "<h4>[The average start and stop times are based upon a 30-day running average.]<br>\n";
print "<font color=\"#660000\">If this page fails to update after 5 minutes hit reload to clear cache.</font><\h4><hr>\n";
print "<H3><A HREF=\"../prodstat_new/\">Click here for the frames version of this page.</A></h3><hr>\n";
print "<h3>Images of NCEP's forecast models can be viewed <A HREF=\"http://mag.ncep.noaa.gov/NCOMAGWEB/appcontroller\">here</A></h3>\n";
print "<H3>Subscribe to the NCEP Production Suite change notification mailing list ";
print "<A HREF=\"https://lstsrv.ncep.noaa.gov/mailman/listinfo/ncep.list.rfcmemo\">here.</A><hr>\n";
#print "<tr><td colspan=\"4\"><center>Click on <img SRC=\"pics/mini-doc1.gif\"> to get a listing of products produced by each job and NCEP/OSO product delivery times.</td></tr>\n";
#print "<tr><td colspan=\"4\"><center>Click on <img SRC=\"pics/mini-graph.gif\"> to see a graph of the 30-day history of start and stop times for a selected job.</td></tr>\n";

print "<br><br><table BORDER COLS=5 WIDTH=\"100%\" ><tr><td><center>CURRENT STATUS OF COMMS TO NCEP CCS</center></td><td BGCOLOR=\"00CC33\"><center><font color=\"000000\">UP</font></center></td></tr></table>\n";
print "<h3> <A HREF=\"http://tgftp.nws.noaa.gov/tgstatus/\">NCEP/NWS STATUS MESSAGES</A></h3>\n";
print "<h4>The <A HREF=\"#LEGEND\">LEGEND</A> is at the bottom of the page.</h4><hr>\n";

print "<br>\n";

$table_flag=0;
$target=0;
open( FIX, "$statusfix" );
while ( <FIX> ) {
    chop;
    #
    # Parse line using colon as the delimiter
    #
    ( $jid, $key, $jid2, $product, $graph ) = split( /\:/ );
    
    if ( $jid eq "" ) {
	print TEXT "${key}|||||\n";
	if ( $table_flag != 0 ) {
	    print "</table>\n";
	    print "<br><br>$key\n";
	} else {
	    $table_flag=1;
	    print "<br><br>$key\n";
	}
	$suite = $key;
	if ( $key !~ m#CYCLE# ) {
	     print "<table BORDER COLS=5 WIDTH=\"100%\" >\n";
	     print "<tr>\n";
	     print "<td><font color=\"#006600\">EVENT</td>\n";
	     print "<td><font color=\"#006600\">Average Start Time</td>\n";
	     print "<td><font color=\"#006600\">Average End Time</td>\n";
	     print "<td><font color=\"#006600\">STATUS</td>\n";
	     print "<td><font color=\"#006600\">COMMENTS</td></tr>\n";
	 } 
    } else {
	( $junk, $tracker_job ) = split( /.*\//,$jid2 );
	if ( $jid =~ m#$canceled# ) {
	     print TEXT "$key|$a30start{$jid}|$a30stop{$jid2}|CANCELED||CANCELED\n";
	     $bgcolor = "#000000";
	     $txtcolor = "#FFCC00";
	     $status = "CANCELED";
	     $comment = "CANCELED";
	 } elsif ( $jid =~ m#gdas18# && $HOUR >= 12 && $completem1{$jid2} ne "" ) {
		   $diff = $a30start_sec{$jid} - time2sec($TIME);
		   if ( $a30start_sec{$jid} < 21600 ) { 
		       $diff = $a30start_sec{$jid} + 86400 - time2sec($TIME);
		   }
		   $status = "START DELAYED";
		   $txtcolor = "#000000";
		   $flash = "";
		   $flashoff = "";
		   if ( $diff >= -900 ) {
		       $comment = "ON-TIME";
		       $status = "SCHEDULED";
		       $txtcolor = "#3366FF";
		       $bgcolor = "#FFFFFF";
		   } elsif ( $diff >= -1800 ) {
		       $comment = "15-30 MIN. LATE";
		       $bgcolor = "#FFFF00";
		   } elsif ( $diff >= -2700 ) {
		       $comment = "31-45 MIN. LATE";
		       $bgcolor = "#FF6600";
		   } elsif ( $diff >= -3600 ) {
		       $comment = "46-60 MIN. LATE";
		       $bgcolor = "#FF0000";
		   } elsif ( $diff >= -7200 ) { 
		       $comment = "1-2 HOURS LATE"; 
		       $bgcolor = "#FF0000";
		       $flash = "<blink>";
		       $flashoff = "</blink>";
		   } elsif ( $diff >= -10800 ) {
		       $comment = "2-3 HOURS LATE";
		       $bgcolor = "#CC33CC";
		       $flash = "<blink>";
		       $flashoff = "</blink>";
		   } else { 
		       $comment = ">3  HOURS LATE";
		       $txtcolor = "#FF0000";
		       $bgcolor = "#000000";
		       $flash = "<blink>";
		       $flashoff = "</blink>";
		   }
		   print TEXT "$key|$a30start{$jid}|$a30stop{$jid2}|$status||$comment\n";
	       } elsif ( $complete{$jid2} ne "" ) {
	     $diff = $a30stop_sec{$jid2} - time2sec($comp_time{$jid2});
	     if ( $a30stop_sec{$jid2} < 21600 && time2sec($comp_time{$jid2}) > 64800 ) { 
		 $diff = $a30stop_sec{$jid2} + 86400 - time2sec($comp_time{$jid2});
	     }
	     $flash = "";
	     $flashoff = "";
	     $bgcolor = "#FFFFFF";
	     $txtcolor = "#000000";
	     $status = "COMPLETE-$comp_time{$jid2}";
	     if ( $diff >= -900 ) {
		 $comment = "ON-TIME";
	     } elsif ( $diff >= -1800 ) {
		 $comment = "15-30 MIN. LATE";
		 $bgcolor = "FFFF00";
	     } elsif ( $diff >= -2700 ) {
		 $comment = "31-45 MIN. LATE";
		 $bgcolor = "FF6600";
	     } elsif ( $diff >= -3600 ) {
		 $comment = "46-60 MIN. LATE";
		 $bgcolor = "FF0000";
	     } elsif ( $diff >= -7200 ) {
		 $comment = "1-2 HOURS LATE";
		 $bgcolor = "#FF0000";
		 $flash = "<blink>";
		 $flashoff = "</blink>";
	     } elsif ( $diff >= -10800 ) {
		 $comment = "2-3 HOURS LATE";
		 $bgcolor = "#CC33CC";
		 $flash = "<blink>";
		 $flashoff = "</blink>";
	     } else {
		 $comment = ">3  HOURS LATE";
		 $txtcolor = "#FF0000";
		 $bgcolor = "#000000";
		 $flash = "<blink>";
		 $flashoff = "</blink>";
	     }
	     print TEXT "$key|$a30start{$jid2}|$a30stop{$jid2}|COMPLETE|$comp_time{$jid2}|$comment\n";
	 } elsif ( $jid =~ m#prod12# && $HOUR < 12 && $completem1{$jid2} ne "" ) {
		   $diff = $a30stop_sec{$jid2} - time2sec($compm1_time{$jid2});
		   if ( $a30stop_sec{$jid2} < 21600 && time2sec($compm1_time{$jid2}) > 64800 ) { 
		       $diff = $a30stop_sec{$jid2} + 86400 - time2sec($compm1_time{$jid2});
		   }

		   $flash = "";
		   $flashoff = "";
		   $bgcolor = "#FFFFFF";
		   $txtcolor = "#000000";
		   $status = "COMPLETE-$compm1_time{$jid2}";
		   if ( $diff >= -900 ) {
		       $comment = "ON-TIME";
		   } elsif ( $diff >= -1800 ) {
		       $comment = "15-30 MIN. LATE";
		       $bgcolor = "FFFF00";
		   } elsif ( $diff >= -2700 ) {
		       $comment = "31-45 MIN. LATE";
		       $bgcolor = "FF6600";
		   } elsif ( $diff >= -3600 ) {
		       $comment = "46-60 MIN. LATE";
		       $bgcolor = "FF0000";
		   } elsif ( $diff >= -7200 ) {
		       $comment = "1-2 HOURS LATE";
		       $bgcolor = "#FF0000";
		       $flash = "<blink>";
		       $flashoff = "</blink>";
		   } elsif ( $diff >= -10800 ) {
		       $comment = "2-3 HOURS LATE";
		       $bgcolor = "#CC33CC";
		       $flash = "<blink>";
		       $flashoff = "</blink>";
		   } else {
		       $comment = ">3  HOURS LATE";
		       $txtcolor = "#FF0000";
		       $bgcolor = "#000000";
		       $flash = "<blink>";
		       $flashoff = "</blink>";
		   }
		   print TEXT "$key|$a30start{$jid}|$a30stop{$jid2}|COMPLETE|$compm1_time{$jid2}|$comment\n";
	       } elsif ( $running{$jid} ne "" ) {
		   #
		   # If this is the first running job in the list of all jobs
		   # then place a HTML target on the page.
		   #
		   if ( $target == 0 ) {
		       $target=1;
		       print "<a NAME=\"TARGET\"></a>\n";
		   }
		   $diff = $a30start_sec{$jid} - time2sec($start_time{$jid});
		   $end_lag = $a30stop_sec{$jid2} - time2sec($TIME) - $diff;
#		   $end_lag = 0;
		  $flash = "";
		  $flashoff = "";
		  $bgcolor = "#00CC33";
		  $status = "RUNNING-$start_time{$jid}";
		  if ( $diff >= -900 ) {
		      $comment = "ON-TIME";
		      $txtcolor = "#000000";
		  } elsif ( $diff >= -1800 ) {
		      $comment = "15-30 MIN. LATE";
		      $txtcolor = "#FFFF00";
		  } elsif ( $diff >= -2700 ) {
		      $comment = "31-45 MIN. LATE";
		      $txtcolor = "#FF6600";
		  } elsif ( $diff >= -3600 ) {
		      $comment = "46-60 MIN. LATE";
		      $txtcolor = "#FF0000";
		  } elsif ( $diff >= -7200 ) { 
		      $comment = "1-2 HOURS LATE"; 
		      $txtcolor = "#FF0000";
		      $flash = "<blink>";
		      $flashoff = "</blink>";
		  } elsif ( $diff >= -10800 ) {
		      $comment = "2-3 HOURS LATE";
		      $txtcolor = "#CC33CC";
		      $flash = "<blink>";
		      $flashoff = "</blink>";
		  } else { 
		      $comment = ">3  HOURS LATE";
		      $bgcolor = "#000000";
		      $txtcolor = "#FF0000";
		      $flash = "<blink>";
		      $flashoff = "</blink>";
		  }
                  if ( $end_lag <= -900 ) {
		      $comment = "JOB RUNNING TOO LONG";
#		      $bgcolor = "#663300";
#		      $txtcolor = "#FF0000";
                      $flash = "<blink>";
                      $flashoff = "</blink>";
		  }
                   if ( $end_lag <= -7200 ) {
                       $status = "CANCELED";
                       $comment = "CANCELED";
                       $cond = 22;
                   }
	    print TEXT "$key|$a30start{$jid}|$a30stop{$jid2}|RUNNING|$start_time{$jid}|$comment\n";
	       } elsif ( $complete{$jid} ne "" && $complete{$jid2} eq "" ) {
		   #
		   # This is for the case where the job used to signal the
		   # start is different than the job that signals the 
		   # completeion
		   #

		   #
		   # If this is the first running job in the list of all jobs
		   # then place a HTML target on the page.
		   #
		   if ( $target == 0 ) {
		       $target=1;
		       print "<a NAME=\"TARGET\"></a>\n";
		   }
		   $diff = $a30start_sec{$jid} - time2sec($comp_start_time{$jid});
		  $end_lag = $a30stop_sec{$jid2} - time2sec($TIME) - $diff;
		  $flash = "";
		  $flashoff = "";
		  $bgcolor = "#00CC33";
		  $status = "RUNNING-$comp_start_time{$jid}";
		  if ( $diff >= -900 ) {
		      $comment = "ON-TIME";
		      $txtcolor = "#000000";
		  } elsif ( $diff >= -1800 ) {
		      $comment = "15-30 MIN. LATE";
		      $txtcolor = "#FFFF00";
		  } elsif ( $diff >= -2700 ) {
		      $comment = "31-45 MIN. LATE";
		      $txtcolor = "#FF6600";
		  } elsif ( $diff >= -3600 ) {
		      $comment = "46-60 MIN. LATE";
		      $txtcolor = "#FF0000";
		  } elsif ( $diff >= -7200 ) { 
		      $comment = "1-2 HOURS LATE"; 
		      $txtcolor = "#FF0000";
		      $flash = "<blink>";
		      $flashoff = "</blink>";
		  } elsif ( $diff >= -10800 ) {
		      $comment = "2-3 HOURS LATE";
		      $txtcolor = "#CC33CC";
		      $flash = "<blink>";
		      $flashoff = "</blink>";
		  } else { 
		      $comment = ">3  HOURS LATE";
		      $bgcolor = "#000000";
		      $txtcolor = "#FF0000";
		      $flash = "<blink>";
		      $flashoff = "</blink>";
		  }
                  if ( $end_lag <= -900 ) {
		      $comment = "JOB RUNNING TOO LONG";
#		      $bgcolor = "#663300";
#		      $txtcolor = "#FF0000";
                      $flash = "<blink>";
                      $flashoff = "</blink>";
		  }
                   if ( $end_lag <= -7200 ) {
                       $status = "CANCELED";
                       $comment = "CANCELED";
                       $cond = 22;
                   }
	    print TEXT "$key|$a30start{$jid}|$a30stop{$jid2}|RUNNING|$comp_start_time{$jid}|$comment\n";
	} else {
	    $diff = $a30start_sec{$jid} - time2sec($TIME);
	    $status = "START DELAYED";
	    $txtcolor = "#000000";
	    $flash = "";
	    $flashoff = "";
	    if ( $diff >= -900 ) {
		$comment = "ON-TIME";
		$status = "SCHEDULED";
		$txtcolor = "#3366FF";
		$bgcolor = "#FFFFFF";
	    } elsif ( $diff >= -1800 ) {
		$comment = "15-30 MIN. LATE";
		$bgcolor = "#FFFF00";
	    } elsif ( $diff >= -2700 ) {
		$comment = "31-45 MIN. LATE";
		$bgcolor = "#FF6600";
	    } elsif ( $diff >= -3600 ) {
		$comment = "46-60 MIN. LATE";
		$bgcolor = "#FF0000";
            } elsif ( $diff >= -7200 ) { 
		$comment = "1-2 HOURS LATE"; 
                $bgcolor = "#FF0000";
		$flash = "<blink>";
		$flashoff = "</blink>";
	    } elsif ( $diff >= -10800 ) {
		$comment = "2-3 HOURS LATE";
                $bgcolor = "#CC33CC";
                $flash = "<blink>";
                $flashoff = "</blink>";
	    } else { 
		$comment = ">3  HOURS LATE";
		$txtcolor = "#FF0000";
                $bgcolor = "#000000";
                $flash = "<blink>";
                $flashoff = "</blink>";
	    }
	    print TEXT "$key|$a30start{$jid}|$a30stop{$jid2}|$status||$comment\n";
	}
	print "<tr BGCOLOR=\"$bgcolor\">\n";
	if ( $product ne "NO" && $graph ne "NO" ) {
	    print "<td><a href=\"$job_search$tracker_job\"><img SRC=\"pics/mini-doc1.gif\"></a><img SRC=\"pics/mini-graph.gif\"><font color=\"$txtcolor\">$key</td>\n";
	} elsif ( $graph ne "NO" ) {
	    print "<td><img SRC=\"pics/mini-graph.gif\"><font color=\"$txtcolor\">$key</td>\n";
	} elsif ( $product ne "NO" ) {
	    print "<td><a href=\"$job_search$tracker_job\"><img SRC=\"pics/mini-doc1.gif\"></a><font color=\"$txtcolor\">$key</td>\n";
	} else {
	    print "<td><font color=\"$txtcolor\">$key</td>\n";
	}
	print "<td><font color=\"$txtcolor\">$a30start{$jid}</td>\n";
	print "<td><font color=\"$txtcolor\">$a30stop{$jid2}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$target_time{$jid2}</td>\n";
	print "<td>$flash<font color=\"$txtcolor\">$status$flashoff</td>\n";
	print "<td>$flash<font color=\"$txtcolor\">$comment$flashoff</td></tr>\n";
    }
}

print "</table>\n";

print "<br><br><a NAME=\"LEGEND\"></a>\n";
print "<table border><th colspan=\"4\">LEGEND</th>\n";
print "<tr><td colspan=\"4\"><center>When a job's status is \"RUNNING\" the time next to it is today's start time.</td></tr>\n";
print "<tr><td colspan=\"4\"><center>When a job's status is \"COMPLETE\" the time next to it is today's end time.</td></tr>\n";
print "<tr><td colspan=\"4\"> </td></tr>\n";
print "<tr><td BGCOLOR=\"#FFFFFF\"><font color=\"#3366FF\">SCHEDULED</td>\n";
print "<td>NOT RUNNING: NO FORESEEN DELAYS</td>\n";
print "<td BGCOLOR=\"#000000\"><font color=\"#FFCC00\">CANCELED</td>\n";
print "<td>HAS BEEN CANCELED</td></tr>\n";
print "<tr><td>COMPLETE</td>\n";
print "<td>FINISHED ON TIME</td>\n";
print "<td BGCOLOR=\"#00CC33\">RUNNING</td>\n";
print "<td>RUNNING   ON TIME</td></tr>\n";
print "<tr><td BGCOLOR=\"#FFFF00\">COMPLETE/START DELAYED</td>\n";
print "<td>FINISHED/DELAYED 15-30 MINUTES</td>\n";
print "<td BGCOLOR=\"#00CC33\"><font color=\"#FFFF00\">RUNNING</td>\n";
print "<td>RUNNING   15-30 MINUTES LATE</td></tr>\n";
print "<tr><td BGCOLOR=\"#FF9900\">COMPLETE/START DELAYED</td>\n";
print "<td>FINISHED/DELAYED 31-45 MINUTES</td>\n";
print "<td BGCOLOR=\"#00CC33\"><font color=\"#FF9900\">RUNNING</td>\n";
print "<td>RUNNING   31-45 MINUTES LATE</td></tr>\n";
print "<tr><td BGCOLOR=\"#FF0000\">COMPLETE/START DELAYED</td>\n";
print "<td>FINISHED/DELAYED 46-60 MINUTES</td>\n";
print "<td BGCOLOR=\"#00CC33\"><font color=\"#FF0000\">RUNNING</td>\n";
print "<td>RUNNING   46-60 MINUTES LATE</td></tr>\n";
print "<tr><td BGCOLOR=\"#FF0000\"><blink>COMPLETE/START DELAYED</blink></td>\n";
print "<td>FINISHED/DELAYED 1-2 HOURS</td>\n";
print "<td BGCOLOR=\"#00CC33\"><font color=\"#FF0000\"><blink>RUNNING</blink></td>\n";
print "<td>RUNNING   1-2 HOURS LATE</td></tr>\n";
print "<tr><td BGCOLOR=\"#CC33CC\"><blink>COMPLETE/START DELAYED</blink></td>\n";
print "<td>FINISHED/DELAYED 2-3 HOURS</td>\n";
print "<td BGCOLOR=\"#00CC33\"><font color=\"#CC33CC\"><blink>RUNNING</blink></td>\n";
print "<td>RUNNING   2-3  HOURS LATE</td></tr>\n";
print "<tr><td BGCOLOR=\"#000000\"><font color=\"#FF0000\"><blink>COMPLETE/START DELAYED</blink></td>\n";
print "<td>FINISHED/DELAYED MORE THAN 3 HOURS</td>\n";
print "<td BGCOLOR=\"#000000\"><font color=\"#FF0000\"><blink>RUNNING</blink></td>\n";
print "<td>RUNNING   MORE THAN 3 HOURS LATE</td></tr>\n";
print "</table>\n";

print "<hr>For questions or comments related to this website, send mail <A HREF=\"mailto:sdm\@noaa.gov\">here</A>.<BR>NCEP/NCO Production Management Branch\n";
print "<hr><TABLE BORDER=2 CELLPADDING=2 CELLSPACING=2><TR><TD><FONT SIZE=\"-1\"><A HREF=\"http://www.nws.noaa.gov/disclaimer.html\"><B><EM>National Weather Service Web Page Disclaimer</EM></B></A></TD></TR></table>\n";

close FIX;
close TEXT;
close HTML;

