![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unknown error alert message when connecting to the iTunes Store | iBot | OS X Support RSS | 0 | 06-01-2009 11:15 PM |
| compare two files if doesnt match then display error message | atl@mav | UNIX for Dummies Questions & Answers | 2 | 03-03-2009 10:57 AM |
| email Alert | fed.linuxgossip | Shell Programming and Scripting | 4 | 10-07-2007 10:25 PM |
| sendmail and message alert | abhijeetkul | UNIX for Advanced & Expert Users | 1 | 05-23-2006 02:18 AM |
| Email alert script | moon | Shell Programming and Scripting | 1 | 04-26-2002 05:55 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Email alert doesnt contain any message
I have created a script which will monitor disk space in unix, it will send an email alert that will notify the specified receipients. I used echo in the mailx command but the email doesnt contain any message. I have used printf to store the message ($message2) and when tried to display on the screen using echo command the value appeared. I have also tried to use the cat command but still no message in the email. Below is the script.
#!/bin/sh 2 HOST=`uname -s` 3 LIST="apps/AI2dbFeeds apps/ai2install apps/data_transfer apps/informatica apps/oracle apps/samba apps/tsm" 4 SYSTIME=`date` 5 #SYSTIME=`date | sed -e 's/BST//'` 6 #SYSTIME=`date +"%OH:%OM"` 7 LEVEL1=40 8 LEVEL2=90 9 LEVEL3=95 10 MAILGRP="leah.dimapawi@db.com" 11 MESS="/apps/informatica/current/pmserver/Scripts/message2" 12 13 for i in $LIST 14 do 15 XXX=`df -k | grep $i|sed -e 's/%//'|awk '{print $5}'` 16 #echo $i 17 #echo $XXX 18 if [ "$XXX" -ge "$LEVEL1" ] 19 then 20 message= echo "$SYSTIME : $HOST /$i $XXX% Full!" 21 printf "$message" >> "$message2" 22 echo $message2 24 fi 25 done 26 27 28 #cat $message2 < /dev/null | mailx -s "ETL UAT - UNIX Disk Space Utilization" $MAILGRP 29 echo $message2 | mailx -s "ETL UAT - UNIX Disk Space Utilization" $MAILGRP |
|
||||
|
use code tags please.
Quote:
I am quite sure there are some syntax errors. line 20: when you execute a command for a variable, use $(). Code:
message=$(echo "$SYSTIME : $HOST /$i $XXX% Full!") "$message2" must be a file. I couldn't see you have defined anything to it. what are you getting with "echo $message2" ?? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|