#/bin/sh
#this shell script is used to check the disk's use
#author colin
#file check_df.sh
#date 2010-09-06
home_base=/home/oracle/shell check_dir=${home_base}/check check_file=${check_dir}/check_file.txt check_point=93 cd ${home_base} if [ ! -d ${check_dir} ] then mkdir -p ${check_dir} fi
df_use=`df -lh|grep opt|awk '{print substr($5,1,2)}'`
while [ ${df_use} -lt ${check_point} ] do echo "the disk is free at" >${check_file} date +"%Y-%m-%d %H:%M:%S" >>${check_file} sleep 60m df_use=`df -lh|grep opt|awk '{print substr($5,1,2)}'` done df -lh|grep opt>${check_file} mail -s "disk alert" songyunkui@kingsoft.com <${check_file}
|