LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-14-2011, 05:00 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 36
How would i mail in html format?(Formatting Help)


I have written a scripts that checks the load average of server and if it is more than 5 it send a mail describing Current Load Average and High CPU/RAM processes .

The problem is I want to send these information in html form .I have done necessary coding to do the same but whenever i try to include the output of following It doesnt seems to be properly formatted.

Code:
echo "Top 10 CPU Utilized Processes" >> /tmp/Load_Average_Check.html
ssh -Tqn $1 ps auxf | sort -nr -k 3 | head -10 >> /tmp/Load_Average_Check.html
echo "-------------------------------------" >> /tmp/Load_Average_Check.html
echo "Top 10 Memory Utilized Processes" >> /tmp/Load_Average_Check.html
ssh -Tqn $1 ps auxf | sort -nr -k 4 | head -10 >> /tmp/Load_Average_Check.html
Output is as below.
Code:
******************************************************* Top 10 CPU Utilized Processes root 28679 2.5 0.0 34916 6688 ? Sl 00:05 20:59 \_ /usr/lib/xen/bin/qemu-dm -d 387 -domain-name XXXXXX -videoram 4 -k en-us -vnc 0.0.0.0:0,password -vncunused -vcpus 1 -boot c -localtime -serial pty -acpi -usbdevice tablet -net nic,vlan=1,macaddr=00:16:3E:67:92:4F,model=rtl8139 -net tap,vlan=1,ifname=tap387.0,bridge=XXXX -M xenfv root 32002 2.3 0.0 34712 4784 ? Sl Apr06 283:01 \_ /usr/lib/xen/bin/qemu-dm -d 372 -domain-name XXXXXXXX -videoram 4 -k en-us -vnc 0.0.0.0:0 -vncunused -vcpus 2 -boot c -localtime -serial pty -acpi -usbdevice tablet -net nic,vlan=1,macaddr=00:16:3E:19:32:09,model=rtl8139 -net tap,vlan=1,ifname=tap372.0,bridge=XXXX -M xenfv root 26933 1.9 0.0 0 0 ? Z 13:36 0:00 \_ [python] root 1815 1.9 0.0 35020 6852 ? Sl Feb17 1553:59 \_ /usr/lib/xen/bin/qemu-dm -d 261 -domain-name XXXXXX -videoram 4 -k en-us -vnc 0.0.0.0:0,password -vncunused -vcpus 2 -boot c -localtime -serial pty -acpi -usbdevice tablet -net nic,vlan=1,macaddr=00:16:3E:53:90:60,model=rtl8139 -net
Its so difficult to understand when i mail the information in plain text i can see the output properly formatted.

Is there any way i can send some part of script output in html while other in plain text ?
I hope i m not confusing ...
 
Old 04-14-2011, 07:57 AM   #2
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 595

Rep: Reputation: 115Reputation: 115
Well, the starting point is you don't seem to be using any HTML. You're just sending plain text to a file that has an html file extension.

Where's the HTML?
 
Old 04-15-2011, 12:16 AM   #3
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 36
Quote:
Originally Posted by zordrak View Post
Well, the starting point is you don't seem to be using any HTML. You're just sending plain text to a file that has an html file extension.

Where's the HTML?
I have not posted the entire code .Its just a little part of the script.

I have added necessary tags to make it a html file.
Like <html><body></body></html>
I can even see the message in html format but its too difficult to understand the output.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SVN : - some mails are coming in plain format (html coding) & some in html format deepakdeore2004 Linux - General 0 05-06-2010 02:54 AM
shell script help with HTML formatting (??) cbtshare Programming 9 01-12-2010 11:09 AM
HTML Table Formatting Inbhir Pheofharain Programming 17 07-20-2009 04:02 PM
html formatting thunderbird sharky Linux - Software 4 01-17-2006 03:33 PM
E-mail Evolution veiwing HTML Format David@330 Linux - Newbie 5 09-15-2004 10:44 AM


All times are GMT -5. The time now is 01:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration