shell 脚本(一)

网友投稿 821 2022-05-28

#检查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 }'|sort>/tmp/lsdevname.txt

lsvg -p testvg |awk '{print }'|sort>/tmp/lspvname.txt

for cdpdisk in `sort /tmp/lsdevname.txt /tmp/lspvname.txt|uniq -d`; do

ACCOUNT_LINE01=`lsdev -l $cdpdisk |awk '{print }'`

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 }'|sort>/tmp/lsdevname.txt

lsvg -p testvg |awk '{print }'|sort>/tmp/lspvname.txt

shell 脚本(一)

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

Shell

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:10分钟彻底理解Redis持久化和主从复制
下一篇:Kafka命令行使用指南
相关文章