The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 08-23-2007
vgersh99's Avatar
vgersh99 vgersh99 is offline
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,165
Quote:
Originally Posted by ghostdog74 View Post
thanks, its good practice to close that. However, the "if" part, i don't think its needed. but if you could enlighten why its needed, it would be great.
oooops, my bad - I didn't see clearly what you're doing - sorry 'bout that:
Code:
df -k | awk 'int($5) > 95 { 
  subject = $1 " More than 95% disk usage "
  email = "email@test.com"
  cmd = "mailx -s \"" subject "\" " email
  cmd  | getline #or system(cmd)
  close(cmd)
  }
'
for the OP benefit.... if you're under Solaris - use 'nawk' instead of 'awk'.

And once again - sorry for the confusion!

Last edited by vgersh99; 08-23-2007 at 08:27 AM..
Reply With Quote