博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
/test-definitions/blob/master/auto-test/blktrace/blktrace.sh
阅读量:4213 次
发布时间:2019-05-26

本文共 1722 字,大约阅读时间需要 5 分钟。

#!/bin/sh -eset -x#cd 到utils 路径,然后执行这个路径下的两个脚本文件后,通过cd - 返回到当前目录cd ../../utils    . ./sys_info.sh      ./sh-test-libcd -#通过whoami 判断是否是root 用户,如果是root用户,则输出rootif [ `whoami` != 'root' ] ; then    echo "You must be the superuser to run this script" >&2    exit 1fiversion="1.0.5"from_repo="Estuary"package="blktrace"#打印需要安装的包的名字for P in ${package};do    echo "$P install"# Install packagecase $distro in    "centos" )	#目前看起来只支持centos,则通过yum安装这个包         yum install -y "$P"         print_info $? "$P"         ;; esac# Check the package version && source#检查包的信息和repo信息是否正确#首先得到repo信息 from=$(yum info $P | grep "From repo" | awk '{print $4}') if [ "$from" = "$from_repo" ];then     echo "$P source is $from : [pass]" | tee -a ${RESULT_FILE} else     rmflag=1     if [ "$from" != "Estuary" ];then	 #如果repo信息不对,则删除这个包         yum remove -y $P         yum install -y $P         from=$(yum info $P | grep "From repo" | awk '{print $4}')        if [ "$from" = "$from_repo"  ];then           echo "$P install  [pass]" | tee -a ${RESULT_FILE}        else           echo "$P source is $from : [failed]" | tee -a ${RESULT_FILE}        fi     fi fi#得到这个包的版本信息 vers=$(yum info $P | grep "Version" | awk '{print $3}') #判断这个包的版本信息是否相等,本质上就是判断字符串是否相等 if [ "$vers" = "$version"  ];then     echo "$P version is $vers : [pass]" | tee -a ${RESULT_FILE} else     echo "$P version is $vers : [failed]" | tee -a ${RESULT_FILE} fidone#执行blktrace 命令,并输出结果# Display the blktrace result on screen.blktrace -d /dev/sda -w 5 -o - |blkparse -i -print_info $? display# Output the blktrace result on file.blktrace -d /dev/sda -w 10 -o trace | blkparse -i -print_info $? output#测试完成后删除这个包.# Remove the blktrace packageyum remove -y "$P"print_info $? remove

转载地址:http://dwnmi.baihongyu.com/

你可能感兴趣的文章
ARC MRC 变换
查看>>
Swift cell的自适应高度
查看>>
【linux】.fuse_hiddenXXXX 文件是如何生成的?
查看>>
【LKM】整合多个LKM为1个
查看>>
【Windows C++】调用powershell上传指定目录下所有文件
查看>>
Java图形界面中单选按钮JRadioButton和按钮Button事件处理
查看>>
小练习 - 排序:冒泡、选择、快排
查看>>
SparkStreaming 如何保证消费Kafka的数据不丢失不重复
查看>>
Spark Shuffle及其调优
查看>>
数据仓库分层
查看>>
常见数据结构-TrieTree/线段树/TreeSet
查看>>
Hive数据倾斜
查看>>
TopK问题
查看>>
Hive调优
查看>>
HQL排查数据倾斜
查看>>
DAG以及任务调度
查看>>
LeetCode——DFS
查看>>
MapReduce Task数目划分
查看>>
ZooKeeper分布式锁
查看>>
3126 Prime Path
查看>>