How to generate HTML page from UNIX script out-put? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to generate HTML page from UNIX script out-put?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-01-2013
HHarsh HHarsh is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 20 October 2014, 9:14 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
How to generate HTML page from UNIX script out-put?

Hi All.

This my first post to this forum, and i assuming it will be best out-of all.

I am quite new to Unix scripting so please excuse me for any silly questions -

I am trying to create on Unix script in which it telnet to my server, check the connectivity of the server and then it generate the out-put.

I am getting correct output and everything is fine.

Now i want to extend that to some extend -

Now i want to the output of the script i should get in HTML formats in email.


Code:
conct_asap () {
cd ${home}
 telnet 10.97.111.111 40003 >tap <<EOF
^]
quit
EOF
}
conct_asap 2>asap.log 1>asap.log

grep "Connected" ${home}/asap 2>/dev/null 1>/dev/null
clear
if [ $? -eq 0 ];then
 echo "1]. ${bold}ASAP Check${unbold}"
 echo "_________________________________"
 echo "Connectivity --> UP and Running"

-----------------------------------------------------------------------
So will it possible to generate HTML out-put and send to my mail box ?

Moderator's Comments:
edit by bakunin: two thirds of your post were redundant FONT-, SIZE-, and whatnot-tags, which i just cleared out. Many thanks for creating that work for me, i wouldn't know what to do the whole day otherwise. The only tag you should have used - the CODE-tag - was missing, so i put it in. Was there anything not understandable in "Please use CODE-tags"? Or was it the button for the CODE-tag, which is so deceptively labeled "CODE"?

Last edited by bakunin; 03-01-2013 at 11:02 PM..
Sponsored Links
    #2  
Old 03-01-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 30 October 2014, 6:50 PM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts
Try something like:

Code:
{
     echo "<html><body>"
     echo "1. &nbsp; <b>ASAP Check</b><br>"
     echo "<hr><br>"
     echo "Connectivity --> UP and Running"
     echo "</body></html>"
} | mailx -m -s "Subject 
Content-Type: text/html" user@domain.com

Sponsored Links
    #3  
Old 03-01-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 30 October 2014, 4:02 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,297
Thanks: 45
Thanked 827 Times in 654 Posts
In the function you write a file "tap" which you never use subsequently. Instead you use a file "asap.log", which should be filled with the <stdout> of the function, but there is none, as the only possible output is redirected to "tap".

Your script contains severe syntax errors ("if" without a closing "fi") and can never have run the way you present it.

Look at any HTML-document and you will notice that it is clear text with a fixed structure and tags mixed with the text. Search the web for any HTML reference (there is an abundance of them) and most of them will not only explain the general structure of such an HTML file but also the meaning of every tag. Consult such a reference/introduction and write such a file using "print" (if you use ksh) or "echo" (if you use bash) or whatever output command your shell has - finished.

I hope this helps.

bakunin
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to Use a UNIX Shell Script to Create an HTML Web Page? rami abusweilei AIX 12 12-26-2012 07:05 AM
Script To Generate HTML output Siddheshk Shell Programming and Scripting 2 11-13-2012 10:53 PM
Login page in html on unix ravi18s Web Programming 13 07-21-2009 10:52 AM
how to generate html file using script? kittusri9 Shell Programming and Scripting 2 05-25-2008 11:38 PM
Html web page to Unix Connectivity abhilashnair UNIX and Linux Applications 1 03-06-2008 09:13 AM



All times are GMT -4. The time now is 12:48 AM.