监视磁盘空间shell脚本

监视磁盘hda1

#!/bin/sh

# disk_mon
# monitor the disk space
# get percent column and strip off header row from df
LOOK_OUT=0
until [ "$LOOK_OUT" -gt "90" ]
do
  LOOK_OUT=`df | grep /hda1 | awk '{print $5}' | sed 's/%//g'`
  echo $LOOK_OUT%
  sleep 1
done

echo "Disk hda1 is nearly full!"

你可能感兴趣的:(shell,header,脚本,disk,磁盘)