<div dir="ltr"><pre class="bash"><span style="color: rgb(128, 128, 128); font-style: italic;"><br></span><span style="color: rgb(0, 0, 0); font-weight: bold;"></span></pre><br clear="all">Hi ALL<br><br><br>#!/bin/sh<br># Shell script to monitor or watch the disk space<br>
# It will send an email to $ADMIN, if the (free avilable) percentage<br># of space is >= 90%<br># -------------------------------------------------------------------------<br># Copyright (c) 2005 nixCraft project <<a href="http://cyberciti.biz/fb/">http://cyberciti.biz/fb/</a>><br>
# This script is licensed under GNU GPL version 2.0 or above<br># -------------------------------------------------------------------------<br># This script is part of nixCraft shell script collection (NSSC)<br># Visit <a href="http://bash.cyberciti.biz/">http://bash.cyberciti.biz/</a> for more information.<br>
# ----------------------------------------------------------------------<br># Linux shell script to watch disk space (should work on other UNIX oses )<br># SEE URL: <a href="http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html">http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html</a><br>
# set admin email so that you can get email<br>ADMIN="<a href="mailto:me@somewher.com">me@somewher.com</a>"<br># set alert level 90% is default<br>ALERT=90<br>df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;<br>
do<br>  #echo $output<br>  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )<br>  partition=$(echo $output | awk '{ print $2 }' )<br>  if [ $usep -ge $ALERT ]; then<br>    echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |<br>
     mail -s "Alert: Almost out of disk space $usep" $ADMIN<br>  fi<br>done<br><br><br>Am trying to run the above script on my machine, it gave the following error<br>[root@linux8 script]# ./disk_monitor.sh <br>
./disk_monitor.sh: line 23: [: /dev/mapper/VolGroup00-LogVol00: integer expression expected<br>./disk_monitor.sh: line 23: [: /: integer expression expected<br><br>Any help?<br><br>-- <br>Your search - madunix - did not match any documents. <br>

</div>