Shell script re-mounts the problematic volume

Source: Internet
Author: User

#!/bin/bash
#卷的全路径示例
#pathexample =mount-t Cetusfs 127.0.0.1:/cinderv/var/lib/cinder/volumes/0f6a20f4d81ed9db37f2a87260dd7181
Volumespath= ' Df-h |awk ' {print$1$6} ' |grep volumes ' #获取卷路径
pathrow= ' Df-h |awk ' {print$1$6} ' |grep volumes|wc-l ' #列出卷的数量
Print Pathrow
Print Volumespath
#strerror = ' ll $volumesPath |grep error ' #获取改卷是否有error字符
#判断如果 $error is not empty, the Umount error volume is then restarted and the mount volume is restarted, and if returned is empty endif
For I in NF
Do
Strerror= ' Df-h|grep volumes|awk ' NR = = i{print$6} '
str= ' ls ' $strerror "'
If [-N "$strerror"]
Then
Umount "$volumesPath"
Service Cinder-volume Restart
Mount-t Cetusfs "$volumePath"
Fi
Done

Shell script re-mounts the problematic volume

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.