shell 脚本(一)

举报
snowofsummer 发表于 2020/11/12 12:39:24 2020/11/12
【摘要】 #检查aix系统磁盘状态。#!/usr/bin/kshusage() { echo "WARNING, use this script AT YOUR OWN RISK" echo " Usage: `basename $*` " } echo "========================= echo CDP disk status =================...

#检查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





【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。