This tip was submitted to the SearchWin2000.com tip exchange by member Mac McNeil. Please let other users know...
how useful it is by rating it below.
Do you have any DOS batch jobs that run on a regular basis, maybe for server monitoring or performing housekeeping duties? Do you need to know the realtime status of jobs when they've completed or, even better, while they're still running? Sure you do!
The standard method of accomplishing this would be to redirect an ECHO command to a file that contains the status, as in:
ECHO job finished with no errors at %date% %time% >> Status.txt
Wouldn't it be useful if you could view such a status on a Web page? Well, you can. Instead of echoing plain text to an output file, echo HTML code which can be loaded into a Web page on the fly. All you need to know is a few tips and tricks:
o Use three files -- a header, a footer and the data -- and then combine them when the final HTML file is to be created. This allows simple creation of color schemes, text formatting, etc.
When specifying a percentage as in <td width="33%">, you must enter two %% -- e.g. ^<td width="33%%"^>
set weblog = "c:datastatus.htm" set bggrn="#00FF00" set txtgrn="#000080" :: totcount, failcount and servcount are incremented elsewhere in the code echo ^<html^> >%weblog% echo ^<head^> >>%weblog% echo ^<meta http-equiv="refresh" content="15"^> >>%weblog% echo ^<title^>Final Status^</title^> >>%weblog% echo ^</head^> >>%weblog% echo ^<body bgcolor=%bggrn% text=%txtgrn%^> >>%weblog% echo ^<p^>^<font face="Comic Sans MS" size="3"^>No incidents detected on the most recent pass of job ^<u^>%webname%^</u^>^</font^>^<br^> >>%weblog% echo ^<font face="Comic Sans MS" size="2"^>Checked %servcount% Servers in this pass which completed on: %date% at %time%.^<br^> >>% weblog% echo Since %sdate% at %stime% we have checked %totcount% servers and detected % failcount% failures.^</font^>^</p^> >>%weblog% echo ^</body^> >>%weblog% echo ^</html^> >>%weblog%