until 条件
do
命令1
命令2
...
done
#!/bin/sh
OUTFILE="/tmp/outfile.out"
cat /dev/null > $OUTFILE
function delay_command()
{
sleep 3
echo "hello outfile.out"
}
until [ -s $OUTFILE ]
do
delay_command >> $OUTFILE
done
more $OUTFILE
#!/bin/bash
#监控磁盘分区
Partition="/dev/sda5"
LOOK_OUT=`df | grep "$Partition" | awk '{print $5}' | sed 's/%//g'`
echo $LOOK_OUT
until [ "$LOOK_OUT" -lt "10" ]
do
LOOK_OUT=`df | grep "$Partition" | awk '{print $5}' | sed 's/%//g'`
if [ "$LOOK_OUT" -lt "10" ];then
echo "Filesystem /dev/sda5 is nearly empty" | mail root
fi
sleep 3600
done
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |