#!/bin/bash
#Centos6下安装LoadRunner负载机 #@author Agoly
#@date
#@source 高级测试技术交流圈: yum -y install expect
PASSWD13=""
PASSWD99="Hhly2017" folder="/root/qumf" lrfolder="/opt/HP/HP_LoadGenerator" file="/root/qumf/LR11Generator.sh" #判断/root/qumf目录是否存在
# -d 参数判断 $folder 是否存在
if [[ ! -d "$folder" ]]; then
mkdir "$folder"
echo "************$folder **file make successfully************"
else
echo "************$folder **file exsit************"
fi #判断安装文件/root/qumf/LR11Generator.sh是否存在
# -f 参数判断 $file 是否存在
if [[ ! -f "$file" ]]; then
echo "************${file} **file is not exsit************"
expect -c " spawn scp -r root@192.168.10.99:/root/qumf/LR11Generator.sh /root/qumf/
expect {
\"*assword\"
{
set timeout ;
send \"$PASSWD99\r\";
}
\"yes/no\"
{
send \"yes\r\"; exp_continue;}
}
expect eof"
#scp -r root@192.168.12.13:/root/qumf/lr11_load_gennerators_linux/ /root/qumf/
else
echo "************${file} **file exist************" fi #判断负载linux上是否安装了/opt/HP/HP_LoadGenerator
# -d 参数判断 $lrfile 是否存在
if [[ ! -d "$lrfolder" ]]; then
echo "************$lrfolder **is not installed************"
expect -c " spawn scp -r root@192.168.12.13:/root/qumf/lr11_load_gennerators_linux/ /root/qumf/
expect {
\"*assword\"
{
set timeout ;
send \"$PASSWD13\r\";
}
\"yes/no\"
{
send \"yes\r\"; exp_continue;}
}
expect eof" else
echo "************$lrfolder **has installed************"
exit
fi echo $folder #mv /root/LR11Generator.sh $folder
yum -y install libstdc++.so.
yum -y install libstdc++.i686* #systemctl stop iptables
#systemctl stop firewalld
service iptables stop cd /root/qumf/ chmod lr11_load_gennerators_linux/* cd lr11_load_gennerators_linux/ chmod -R 777 Linux/ cd Linux/ expect -c "
spawn /root/qumf/lr11_load_gennerators_linux/Linux/installer.sh expect \"* ] :\"
send \"n\r\"
expect \"* ] :\"
send \"a\r\"
expect \"* ] :\"
send \"i\r\"
expect \"* ] :\"
send \"f\r\"
expect eof" #expect -c "
#spawn /root/qumf/lr11_load_gennerators_linux/Linux/installer.sh
#expect {
# \"*]*\"
# {
# send \"n\r\"
# send \"a\r\"
# send \"i\r\"
# send \"f\r\"
# }
#}
#expect eof" useradd -g 0 -s /bin/bash loadrunner expect -c " spawn passwd loadrunner expect \"New password:\"
send \"$PASSWD99\r\"
expect \"Retype new password:\"
send \"$PASSWD99\r\"
expect eof" cd /opt/HP/HP_LoadGenerator touch /opt/HP/HP_LoadGenerator/env.sh cat > /opt/HP/HP_LoadGenerator/env.sh <<EOF
#!/bin/bash
export PRODUCT_DIR=/opt/HP/HP_LoadGenerator
export M_LROOT=\$PRODUCT_DIR
export LD_LIBRARY_PATH=\$M_LROOT/bin:\$M_LROOT/lib:/usr/lib:/usr/lib64
export DISPLAY='0.0'
export PATH=\$PATH:\$M_LROOT/bin
EOF sed -i '$a source /opt/HP/HP_LoadGenerator/env.sh' /etc/profile expect -c " spawn su - loadrunner expect \"$\"
send \"cd /opt/HP/HP_LoadGenerator/bin\r\" expect \"$\"
send \"./m_daemon_setup start\r\" expect \"$\"
send \"ps -ef|grep m_agent_daemon | grep -v grep\r\"
interact
expect eof"

shell脚本实现自动化安装linux版本的loadrunner agent(centos6.8)的更多相关文章

  1. Shell脚本,自动化发布tomcat项目【转载】

    Shell脚本,自动化发布tomcat项目脚本. 1. vko2c_auto_build_by_scp.sh 文件内容: #---------------------start------------ ...

  2. Shell脚本,自动化发布tomcat项目【转】

    Shell脚本,自动化发布tomcat项目脚本. 1. vko2c_auto_build_by_scp.sh 文件内容: #---------------------start------------ ...

  3. Linux Shell脚本编程--Linux特殊符号大全

    Linux Shell脚本编程--Linux特殊符号大全 linux_shell 特殊符号的介绍 2011

  4. [linux] shell脚本编程-xunsearch安装脚本学习

    安装脚本setup.sh #!/bin/sh # FULL fast install/upgrade script # See help message via `--help' # $Id$ # s ...

  5. 脚本实现自动化安装lamp&lnmp

    #备注:前提是将lnmp和lnmp自动化脚本写好放在相应的路径, 脚本已写好,请查看我博客中的 shell脚本 专栏! #!/bin/bash #安装lamp或者lnmp path=/server/s ...

  6. 进阶!基于CentOS7系统使用cobbler实现单台服务器批量自动化安装不同版本系统(week3_day5_part2)-技术流ken

    前言 在上一篇博文<cobbler批量安装系统使用详解-技术流ken>中已经详细讲解了cobbler的使用以及安装,本篇博文将会使用单台cobbler实现自动化批量安装不同版本的操作系统. ...

  7. cobbler单台服务器实现批量自动化安装不同版本系统-技术流ken

    前言 在上一篇博文<cobbler批量安装系统使用详解-技术流ken>中已经详细讲解了cobbler的使用以及安装,本篇博文将会使用单台cobbler实现自动化批量安装不同版本的操作系统. ...

  8. ansible配合shell脚本批量编译安装python3.6.6

    [root@node1:/etc]# tree /etc/ansible/ /etc/ansible/ ├── ansible.cfg ├── hosts ├── python.yml └── rol ...

  9. 使用shell脚本来自动化处理我们的工作,解放双手

    Shell脚本介绍 1.Shell脚本,就是利用Shell的命令解释的功能,对一个纯文本的文件进行解析,然后执行这些功能,也可以说Shell脚本就是一系列命令的集合. 2.Shell可以直接使用在wi ...

随机推荐

  1. SIP协议分析

    - SIP流程 一个标准的SIP通话流程如下: 1. A向B发送一个INVITE消息,邀请B通话. 2.B振铃,向A回复一个RING消息,通知A振铃中,A等待. 3.B提机,向A发一个OK消息,  通 ...

  2. git设置多账户

    1.设置公司gitlab 0.先给git 设置一个全局的账户, 如果是公司的电脑环境, 全局的账户当然是用你在公司的邮箱了 git config --global user.name "yo ...

  3. vue.nextTick()方法的使用详解

    什么是Vue.nextTick()??   定义:在下次 DOM 更新循环结束之后执行延迟回调.在修改数据之后立即使用这个方法,获取更新后的 DOM. 所以就衍生出了这个获取更新后的DOM的Vue方法 ...

  4. keeplived+lvs(主从热备+负载均衡)

    本次实验基于DR负载均衡模式(直接路由),设置一个VIP(Virtual IP)为192.168.1.225,用户只需要访问这个IP地址即可获得网页服务.其中,负载均衡主机为192.168.1.221 ...

  5. office 小技巧

    1. 数据匹配 VLOOKUP 例一:如图,将左表(sheet1)的e列关联到右表(sheet2),条件为: sheet2.字段名 = sheet1.D 公式:=VLOOKUP(sheet2!D2:D ...

  6. 古来月小队 Alpha冲刺阶段博客目录

    一.Scrum Meeting 第六周: 链接:https://www.cnblogs.com/ouc-xxxxxx/p/11789325.html 任务:搭建安卓编程环境,学习安卓前端知识 第七周: ...

  7. mybatis中<include>标签的作用

    MyBatis中sql标签定义SQL片段,include标签引用,可以复用SQL片段 sql标签中id属性对应include标签中的refid属性.通过include标签将sql片段和原sql片段进行 ...

  8. x1

    //程序功能: //要求客户从键盘输入一个整数,判断其是奇是偶 #include <stdio.h> int main(){ int x; printf("输入一个整数:\n&q ...

  9. vue 使用localstorage实现面包屑

    mutation.js代码: changeRoute(state, val) { let routeList = state.routeList; let isFind = false; let fi ...

  10. 在使用confluent-kafka-go 时遇到如下问题

    问题 $ go build t.go # pkg-config --cflags rdkafka Package rdkafka was not found in the pkg-config sea ...