#!/bin/bash
Disk_Warn()
{
Disk_Use=`df -h | awk '///$/{print $5}'|sed 's/%//g'`
TTY=`ps | awk '/bash$/{print $2}'`
[ "$Disk_Use" -gt "60" ] &&{
echo "Date: `date` Warning:Your / is full fix it now!!"
sleep 2
Disk_Warn
}||{
Disk_Warn
sleep 2
}
}
Disk_Warn
输出结果:
[[email protected] mnt]# sh Warn.sh
Date: Sat Aug 25 09:33:57 EDT 2018 Warning:Your / is full fix it now!!
Date: Sat Aug 25 09:33:59 EDT 2018 Warning:Your / is full fix it now!!
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/1735.html