The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-21-2009
lscanaleta lscanaleta is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 2
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
  #2 (permalink)  
Old 07-21-2009
anchal_khare anchal_khare is offline
Registered User
  
 

Join Date: Jun 2007
Location: Mumbai,India
Posts: 325
use code tags please.

Quote:
20 message= echo "$SYSTIME : $HOST /$i $XXX% Full!"
21 printf "$message" >> "$message2"
22 echo $message2

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!")
line 21:
"$message2" must be a file. I couldn't see you have defined anything to it.


what are you getting with "echo $message2" ??
  #3 (permalink)  
Old 07-22-2009
lscanaleta lscanaleta is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 2
This message appears on the screen when I echo $message2:

Wed Jul 22 10:57:38 BST 2009 : SunOS /apps/informatica 71% Full!
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0