The UNIX and Linux Forums  

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
Summary of metadevices (soft partitions,mirror) + filesystems + space iBot Solaris BigAdmin RSS 0 02-04-2009 02:30 PM
Shell script to monitor tmp folder for uploads mrfr0g Shell Programming and Scripting 6 08-19-2008 12:37 PM
Monitor Disk Space sam786 Shell Programming and Scripting 3 02-08-2008 06:56 PM
Automatic monitor disk-space anuradha Filesystems, Disks and Memory 3 01-15-2008 03:37 PM
paging space & monitor Erik Rooijmans UNIX for Dummies Questions & Answers 2 05-13-2003 01:45 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-06-2009
john_doe john_doe is offline
Registered User
  
 

Join Date: May 2009
Posts: 6
Shell script partitions space monitor

Hello friends,

I'm newbie in shell scripting...
Until now i have this script:



Code:
 
#!/bin/sh
emailok = email1@domain.com
emailissue = email2@domain.com
limit="50"
df -h | grep -vE '^Filesystem' | awk '{print $1 " " $4 " " $5}'|while read val
do
partition=$(echo $val | awk '{print $1}')
echo "partition:$partition"
usedspace=$(echo $val | awk '{print $3}'| cut -d'%' -f1)
echo "usedspace:$usedspace%"
availspace=$(echo $val | awk '{print $2}')
echo "space available:$availspace"
echo "limit:$limit"
if [ $usedspace -gt $limit ]; then
echo "less than 50% space in $partition = $availspace"|mail -s "space info" $emailissue
else
echo "All ok." |mail -s "space info" $emailok
fi
done

the problem is that i have 2 partitions, and i receive 2 mails. If i have more than 2, then i will receive more mails.

what i want is to receive 1 mail, with 2 or more messages.

any ideas?

Last edited by john_doe; 05-06-2009 at 10:53 AM..
 

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 07:25 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