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 -->
  #1 (permalink)  
Old 08-23-2007
sriram003 sriram003 is offline
Registered User
 

Join Date: Mar 2007
Posts: 27
Disk Space Monitoring Script

#!/bin/bash
# Disk Space Monitoring for more than 95 %
# and Sending Alerts by Mail


if [ df -k |awk '$5 > 95 ];

then

`df -k |awk '$5 > 95 {print $1 " ----------- " $5}' |mailx -s "More than 95% disk usage in DEV" email@test.com';

else

exit 0

fi


I get the below error:
================
bash-3.00$ ./disk_usage_mail_alert-sriram.sh
./disk_usage_mail_alert-sriram.sh: line 14: syntax error near unexpected token `else'
./disk_usage_mail_alert-sriram.sh: line 14: `else '
Reply With Quote
Remove advertisements
!!
Forum Sponsor