全部博文(33)
2008年(33)
分类:
2008-09-04 13:54:07
在通过dd实施存储迁移,或者别的裸设备数据迁移时,一般通过后台脚本执行,下面脚本就是监控dd后台脚本执行是否完毕,非常直观的知道dd是否已经完成。
linux 环境下
#!/bin/bash
while true
do
DDRUN=$(ps -ef | grep dd | grep -v grep | wc -l)
echo "--------------------------DD IS FINISHED OR NO DD---------------"
exit
else
echo "------------------------DD IS RUNING-----------------------------"
ps -ef | grep dd |grep if | grep -v grep | awk '{print $8,$9,"=",$10,$11,"=",$12,$13,$14}'
date
fi
sleep 10
done
HP unix环境下
#!/sbin/sh
while true
do
DDRUN=$(ps -ef | grep dd | grep -v grep | wc -l)
if [ $DDRUN = 0 ] ; then
echo "--------------------------DD Finished Or No DD Proccess---------------"
exit
else
echo "------------------------DD IS RUNING-----------------------------"
ps -ef | grep dd |grep if | grep -v grep | awk '{print $8,$9,$10,$11}'
date
fi
sleep 10
done