How to Use a UNIX Shell Script to Create an HTML Web Page?

dear friends ,
in my work i have to monitor some system performance in hourly basis by runing some commands , for example (lpstat) to know that all the queue is ready
how can i create webpage and connect it with the server (AIX operating system) and make this page refreshed every 10 second and see the result of that command

your adviced is highly appreciated guys

thanks

---------- Post updated at 02:00 AM ---------- Previous update was at 01:27 AM ----------

please guys i need your help with that

You need Apache web server running with cgi access.

Here is a link that explains how to run a command: date and create the output in HTML format.

This can be replaced with lpstat I hope this helps.

thanks man
we have WAS servers but we have IIS not apache , is it will work on it ???

thanks for your reply

I'm not familiar with IIS, but I found this link. I hope this helps.

thanks man it is usfull
i found good website explain it very good
but the problem that i cannot find the cgi-bin in my server
the server running AIX 6.0
where can i found the Directory ??

Looks like it is not available by default. You have to setup CGI, here is a manual from Microsoft.

i am lost now
do you mean that the cgi-bin must be in IIS server or in the AIX server ??

again i have AIX server ok
and i need to make script with many commands and see the result for this commands in webpage in internet explorer browser ok , and make this commands refrished every 10 seconds
what do i need exactly ??

your help step by step is highly appreciated Sir

If you are not familiar with CGI then I suggest to run a shell script that executes lpstat every 10 seconds.

You can code an infinite while loop that executes lpstat and sleep for 10 seconds. You have to copy the output and publish the output in your local IIS web-server or FTP it and publish if your IIS web-server is running on a remote machine:-

while true
do
    # Run lpstat here and redirect output to a HTML file.
    # FTP or copy this HTML file to publish it in your IIS web-server 
    sleep 10 # Sleep for 10 seconds.
done

thats seems good and easy way man

man lsn to me
can you send your private mail gmail , or yahoo , or hotmail, or skype to talk throw MSN i need to talk to you online
is it possiple ??

I am really sorry, the forum rules demand members to have discussions only in threads.

Please try this approach, let us know if you are stuck at some stage. Members in this forum will be willing to assist you. Thank you.

ohhhhhhh i am sorry man i didnt know that i am just partecipated yesterday in this imazing forums

any way thanks man i will try and will tell you

thanks

1 Like

It seems you have the basics on how to create static html from a command. If you cannot work with CGI you can choose to direct the output to a flatfile (e.g., because you want the output of the last XX minutes).
Then, using cron, every YY minutes you run a second program to create static html in a fixed location that can be "browsed" without the need for CGI.

My apologies for the short answer, my tablet is winning this morning :frowning:

Consider $1="xyz.html"

echo "<head>" >> "$1"
	echo "<title>Testing Result</title>" >> "$1"
	echo "</head>" >> "$1"	
	echo "<body  bgcolor="#CCCCCC">" >> "$1"
	echo "<table width="100%" border="2" bordercolor="#000000">" >> "$1"
	echo "<tr bgcolor="#33CCFF">" >> "$1"
	echo "<td><div align="center"><strong>Testing</strong></div></td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "<table width="100%" border="2" bordercolor="#000000">" >> "$1"
	echo "<tr>" >> "$1"
	echo "<td>�</td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "<table width="100%" border="2">" >> "$1"
	echo "<tr bgcolor=#33CCFF>" >> "$1"
	echo "<td><div align=center><strong>Testing Summary</strong></div></td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "<table width="100%" border="2">" >> "$1"
	echo "<tr>" >> "$1"
	echo "<td width=50%>Test Scenario Executed</td>" >> "$1"
	echo "<td width=50%>TEST_SCENARIO_EXECUTED</td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "<table width="100%" border="2">" >> "$1"
	echo "<tr>" >> "$1"
	echo "<td width=50%>Test Cases Executed</td>" >> "$1"
	echo "<td width=50%>TEST_CASE_EXECUTED</td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "<table width="100%" border="2">" >> "$1"
	echo "<tr>" >> "$1"
	echo "<td width=25%>PASS</td>" >> "$1"
	echo "<td width=25%>PASS_CASES</td>" >> "$1"
	echo "<td width=25%>FAIL</td>" >> "$1"
	echo "<td width=25%>FAIL_CASES</td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "<table width="100%" border="2">" >> "$1"
	echo "<tr>" >> "$1"
	echo "<td>�</td>" >> "$1"
	echo "</tr>" >> "$1"
	echo "</table>" >> "$1"
	echo "</body>" >> "$1"	
	echo "</html>" >> "$1"