in reply to Re: Question about HTML and Perl
in thread Question about HTML and Perl
Here is the perl script, it's setup to return Jobname, Last Start and End Time, but I have commented that out and just want the end time, again, the script works fine from the command line.<HTML> <BODY BGCOLOR='white'" TEXT=BLACK LINK=BLUE VLINK=PURPLE ALINK=RED > <META HTTP-EQUIV="REFRESH" CONTENT="30"> <HEAD> <TITLE>Production Cycle Report Automated Test</TITLE> </HEAD> <BODY> <STYLE TYPE="text/css"> <!-- H1 { color:blue; font-style:italic; } --> </STYLE> <H1> <center>CG Production Cycle Report - TEST</H1> <SCRIPT TYPE="text/javascript"> <!-- Begin // Get today's current date. var now = new Date(); // Array list of days. var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday +','Friday','Saturday'); // Array list of months. var months = new Array('January','February','March','April','May','Jun +e','July','August','September','October','November','December'); // Calculate the number of the current day in the week. var date = ((now.getDate()<10) ? "0" : "")+ now.getDate(); // Calculate four digit year. function fourdigits(number) { return (number < 1000) ? number + 1900 : number; } // Join it all together today = days[now.getDay()] + ", " + months[now.getMonth()] + " " + date + ", " + (fourdigits(now.getYear())) ; // Print out the data. document.write(today); // End --> </script> <SCRIPT Language="JavaScript"> <!-- hide from old browsers // Copyright 1999, 2000 by Ray Stott // OK to use if this copyright is included // Script available at http://www.crays.com/jsc var TimezoneOffset = -8 // adjust for time zone var localTime = new Date() var ms = localTime.getTime() + (localTime.getTimezoneOffset() * 60000) + TimezoneOffset * 3600000 var time = new Date(ms) var hour = time.getHours() var minute = time.getMinutes() var second = time.getSeconds() var curTime = "" + ((hour > 12) ? hour - 12 : hour) if(hour==0) curTime = "12" curTime += ((minute < 10) ? ":0" : ":") + minute curTime += ((second < 10) ? ":0" : ":") + second curTime += (hour >= 12) ? " PM" : " AM" document.write(curTime + " US Pacific Time") //--> </SCRIPT> <TABLE BORDER=2 CELLSPACING=6> <TR> <TH>Key Milestones</TH> <TH>Job Name</TH> <TH>Completed T +ime in PST</TH> <TH>SLA</TH> </TR> <TR> <TD>Transaction Handoff PA to MARS CGTC/CII</TD> <TD><LI><A HREF= +'/cgi-bin/autorep_dev_vsl.pl?job_name=pa_box_settle&level=detail'>pa_ +box_settle</A> </TD> <TD>NA</TD> <TD>8:45pm</TD> </TR> <TR> <TD>Transaction Handoff PA2 to MARS CRMC</TD> <TD><LI><A HREF= +'/cgi-bin/autorep_dev_vsl.pl?job_name=pa2_box_settle&level=detail'>pa +2_box_settle</A> </TD> <TD>NA</TD> <TD>8:30pm</TD> </TR> <TR> <TD>Transaction Handoff PA3 to MARS</TD> <TD><LI><A HREF= +'/cgi-bin/autorep_dev_vsl.pl?job_name=pa3_box_settle&level=detail'>pa +3_box_settle</A> </TD> <TD>NA</TD> <TD>8:30pm</TD> </TR> </TABLE> <STYLE TYPE="text/css"> <!-- H2 { color:blue; font-size:10pt; } --> </STYLE> <H2> <center>Click on job name to view job information</H2> </BODY> </HTML>
Again, thanks, just learning, and wondering if HTML can even do what I'm trying to make it do with the perl script#!/users/contrib/bin/perl use Sybase::Sybperl; use Env qw(BATCH_USER_NAME BATCH_PASSWORD); ############## ############## Subroutines ############## # Send the input string to the DB server and get the results # $_[0] - sql string sub DBEXEC { &dbcmd($dbproc, $_[0]); &dbsqlexec($dbproc); &dbresults($dbproc); } # Turn UTC in to people time sub GETTIME { if ($_[0] eq "999999999") { $time = ("******** **********"); } elsif ($_[0] eq "0") { $time = ("******** **********"); } else { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +$_[0]); $mon++; $time = sprintf ("%.2d:%.2d:%.2d %.2d/%.2d/%.2d", $hour, $min, $se +c, $mon, $mday, $year + 1900); } } # set job status sub JOBSTATUS { if ($_[0] == 9) {$jstatus1 = ("ACTIVATED");} elsif ($_[0] == 5) {$jstatus2 = ("FAILURE");} elsif ($_[0] == 8) {$jstatus3 = ("INACTIVE");} elsif ($_[0] == 11) {$jstatus4 = ("ON_HOLD");} elsif ($_[0] == 7) {$jstatus5 = ("ON_ICE");} elsif ($_[0] == 12) {$jstatus5 = ("QUE_WAIT");} elsif ($_[0] == 10) {$jstatus6 = ("RESTART");} elsif ($_[0] == 1) {$jstatus7 = ("RUNNING");} elsif ($_[0] == 3) {$jstatus8 = ("STARTING");} elsif ($_[0] == 4) {$jstatus9 = ("SUCCESS");} elsif ($_[0] == 6) {$jstatus10 = ("TERMINATED");} } ############ Setup report format ############ format STDOUT = @<<<<<<<<<<<<<<<<<<<<< $etime . ############ ############ Start ############ # if ($ARGV[0] eq "print") { # open(STDOUT,"| lp -dbigtooth -o2"); # } # else { # open(STDOUT,"| elm -s 'Nightly cycle check' \xxxxxxxx\@smtplink"); # } # login to the database $dbproc = &dblogin($BATCH_USER_NAME, $BATCH_PASSWORD, 'SQL_AUTOSYS_DEV +'); #$currdate = &GETTIME(time); #print "Date: $currdate \n\n"; #print " \n"; #print "Jobname Last Start Last End + \n"; #print "------------------------------ -------------------- ---------- +----------\n"; # Submit SQL Statement &DBEXEC("select job.job_name, job_status.last_start, job_status.la +st_end from job, job_status where job.joid = job_status.joid and job.job_name in ('pa_box_settle') order by job_status.last_end"); while(@status = &dbnextrow($dbproc)){ $name = ($status[0]); $stime = &GETTIME($status[1]); $etime = &GETTIME($status[2]); write(STDOUT);} #print "\n\n"; print " \n"; close(STDOUT);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Question about HTML and Perl
by ww (Archbishop) on Nov 07, 2008 at 00:39 UTC |