|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Emergency UNIX and Linux Support !! Help Me!! Post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers. This forum is "best effort" only. Members who reply to posts here receive a bonus of 1000 Bits per reply. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Disk space script output in color
I'm connecting to 15 servers in using ssh and storing disk space details of each server in a text file Finally , I'm emailing that text file at the particular id using mail -x . The report looks something like this.
Filesystem size used avail capacity Mounted on /proc 0K 0K 0K 0% /proc mnttab 0K 0K 0K 0% /etc/mnttab fd 0K 0K 0K 0% /dev/fd /dev/md/dsk/d30 7.9G 6.4G 1.4G 82% /var swap 6.4G 32K 6.4G 1% /var/run /dev/md/dsk/d60 269G 87G 179G 33% /u03 /dev/md/dsk/d40 4.8G 3.4G 1.3G 73% /home swap 512M 456K 512M 1% /tmp /dev/md/dsk/d54 20G 17G 2.5G 88% /u02 /dev/md/dsk/d53 5.9G 5.4G 507M 92% /u01 For file systems which have space greater than 90% , I want to display those in different color or in bold ...I just want to highlight those so that person reading email should get attention quickly to that filesystem but since I am storing the output in .txt file this is not achievable.I tried storing the output in .html file but could not succeed. Is there any easy way to achieve this ?e.g. only the last row in the above report should be in red as below. /dev/md/dsk/d53 5.9G 5.4G 507M 92% /u01 Thanks, Ajay |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
use sendmail
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Thanks itkamaraj but will that display o/p in color for particular condition (> 90% ) ?
|
|
#4
|
||||
|
||||
|
you need to form a html output try the below one for test html file contents output.html Code:
<html> <body> <font color=red><b>90%</b></font> </body> </html> Shell script Code:
( echo "From: abcd@abcd.com" echo "To: abcd@abcd.com" echo "MIME-Version: 1.0" echo "Subject: Test" echo "Content-Type: text/html" cat output.html ) | sendmail -t |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Thanks I am getting
sendmail: not found I am using >uname -a SunOS ssdb0043 5.9 Generic_122300-60 sun4u sparc SUNW,Sun-Fire-V240 Quote:
|
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
hmm.. without sendmail.. i am not sure.. but found this below code in google. just give a try. html file :file.html Code:
From: some.user@other.machine
Subject: Test
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----_=_NextPart_000_01C5B90C.9F15F690"
------_=_NextPart_000_01C5B90C.9F15F690
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE html PUBliC "-//W3C//DTD html 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</head>
<body>
<div>
<b>
Testing 1 2 3.
</b><br>
</div>
</body>
</html>shell code Code:
(cat file.html | mailx user@some.machine) |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
|
| The Following 3 Users Say Thank You to Corona688 For This Useful Post: | ||
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| putting color on output file script | lhareigh890 | Shell Programming and Scripting | 3 | 03-14-2011 05:06 AM |
| disk space utilization script | svajhala | Shell Programming and Scripting | 6 | 12-27-2010 11:24 AM |
| script to log free mem and disk space | enator45 | UNIX for Dummies Questions & Answers | 2 | 06-24-2009 05:34 PM |
| Script for Disk space | Shahul | Shell Programming and Scripting | 3 | 09-24-2008 03:15 AM |
| Disk space script | asadlone | Shell Programming and Scripting | 8 | 06-03-2007 03:32 PM |
|
|