shell 脚本(一)
#检查aix系统磁盘状态。
#!/usr/bin/ksh
usage() {
echo "WARNING, use this script AT YOUR OWN RISK"
echo " Usage: `basename $*` "
}
echo "========================= echo CDP disk status =========================="
for vgname in $*
do
lsdev -Cc disk|grep Falc |awk '{print $1}'|sort>/tmp/lsdevname.txt
lsvg -p testvg |awk '{print $1}'|sort>/tmp/lspvname.txt
for cdpdisk in `sort /tmp/lsdevname.txt /tmp/lspvname.txt|uniq -d`; do
ACCOUNT_LINE01=`lsdev -l $cdpdisk |awk '{print $2}'`
if [ "$ACCOUNT_LINE01" = "Available" ] ; then
echo "$cdpdisk is Available!!!"
else
echo "$cdpdisk is Defined,Please check!!!"
# exit 1
fi
done
done
sleep 5
echo "========================= echo CDP PV status =========================="
for vgname in $*
do
lsdev -Cc disk|grep Falc |awk '{print $1}'|sort>/tmp/lsdevname.txt
lsvg -p testvg |awk '{print $1}'|sort>/tmp/lspvname.txt
for cdpdisk in `sort /tmp/lsdevname.txt /tmp/lspvname.txt|uniq -d`; do
ACCOUNT_LINE02=`lspv $cdpdisk |grep "PV STATE"|awk '{print $3}'`
if [ "$ACCOUNT_LINE02" = "active" ] ; then
echo "$cdpdisk is normal in $vgname!!!"
else
echo "$cdpdisk is non-health in $vgname,Please check!!!"
# exit 1
fi
done
done
sleep 5
echo "========================= check volume group status =========================="
for vgname in $*
do
ACCOUNT_LINE03=`lsvg $vgname |grep "STALE PPs"|awk '{print $3}'`
if [ "$ACCOUNT_LINE03" = "0" ] ; then
echo "$vgname is varyon with no Stale PP!!!"
else
echo "$vgname is varyon but some Stale PP,Please check!!!"
exit 1
fi
done
>/tmp/lsdevname.txt
>/tmp/lspvname.txt
>EOF
- 点赞
- 收藏
- 关注作者
评论(0)