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 -->
  #4 (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
that's very kludgy. the usage of awk is more than meets the eye
try this
Code:
df -k | awk 'if ( 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)
  }
'
modified the original.....
Reply With Quote