Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Disk % and Send Email

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

On a Solaris 8 system I'd like to fire a cron job that runs a script to detect if my /usr1 partition is using more than 95% of it's space and if so send an email.

The email part I think I have but can anyone recommend how to determine the disk space % and set a condidtion to true if > 95% (so I could then send an email if true etc.) %?

Thanks,

Michael42
 
Have you taken a look at the FAQ section? The very first one in this forum has a script to monitor disk usage: faq822-1648
 
Gulp,

Thx - I thought I did. I am promising all significant others on this site to attempt to contribute more than post.

There is room for improvement. :)

Thanks,

Michael42
 
Here's one based on one I wrote for our shop :-
#!/bin/ksh
REMAIN=`df -k |awk '/\/usr1/ {print substr($4,1,length($4) -1)}`
if [ $REMAIN -gt 95 ]
then
mail -s "* WARNING: DISK SPACE LOW (/usr1) *" username
fi

Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top