整理知识点的时候,发现2006-11-28去中组部做盘阵压力测试(双链路冗余)时候写的一个脚本:
#!/bin/bash
path=/media/dc
file=/media/dc/hd.img
num=1
while true do there=`df |grep $path |grep -v grep`
if [ "x" = "x$there" ] then
echo "--------------------------------"
echo "-- the $path is not mount "
echo "-- the progrome will exit --"
echo "--------------------------------" exit else
echo "----------------------------------------"
echo "-- create the 500m $file "
echo "-- --"
echo "-- "`date " %y/%m/%d %t"`" --"
echo "----------------------------------------"
echo "" dd if=/dev/zero of=$file bs=1m count=500
sleep 5 /bin/rm -f $file
echo "----------------------------------------"
echo "-- delete the 500m $file "
echo "-- --"
echo "-- "`date " %y/%m/%d %t"`" --"
echo "-- --"
echo "-- the $num test is over "
echo "----------------------------------------"
echo ""
echo ""
echo "-----------------------------------------------"
echo ""
echo ""
sleep 5
num=`expr $num 1`
fi
done
|
脚本判断/media/dc是否被挂载这盘阵分区,如果挂载着,则dd一个500m的文件到/media/dc里面,然后删掉,一直循环。那是一个双连路冗余的环境,中间将一个光纤卡上的光纤拔掉,测试链路失效切换的功能是否正常。
阅读(2468) | 评论(0) | 转发(1) |