#!/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. sql使用cte表达式进行递归查询

    --递归获取所有子节点 with temp as ( select * from MK_Base_Department where F_DepartmentId='5f258320-c1b7-42a4 ...

  2. python生产者和消费者模式实现(二)多进程方式

    import timeimport randomfrom multiprocessing import Process, Queue # 生产者def producer(q, i): food = ' ...

  3. mysql 实现全连接

    mysql不支持全连接,但可以通过左外连接+ union+右外连接实现 SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id UNION SELECT * FR ...

  4. JavaScript判断是否是数字

    JavaScript判断是否是数字的几种方法 isNaN() /** * 判断是否是数字 */ function isNumber(value){ if(isNaN(value)){ return f ...

  5. 渗透测试学习 十九、 XSS跨站脚本漏洞详解 续2

    二阶注入环境搭建 74cms 3.4 直接将源码放在PHPstudy的www路径下,在地址栏中输入127.0.0.1回车 然后进入网站首页,在填写简历里面存在二阶注入 先注册一个账号 创建简历 前面的 ...

  6. nginx目录详解

  7. input:file样式怎样修改

    问题描述: 我需要点击input:file来修改img中的图片,但是input:file样式太丑 解决办法: 给file设置透明度为0,让用户看不见他 创建新的button按钮 修改button按钮样 ...

  8. Centos 7+KVM(Windows Server 2008 r2 )

    KVM虚拟机 Kernel-based Virtual Machine的简称,是一个开源的系统虚拟化模块,自Linux 2.6.20之后集成在Linux的各个主要发行版本中.它使用Linux自身的调度 ...

  9. LG3389 「模板」高斯消元法 高斯消元

    问题描述 LG3389 题解 高斯消元,是用来解\(n\)元一次方程组的算法,时间复杂度\(O(n^3)\) 这样就构造出了这个方程组的矩阵 目标就是把这个矩阵左边\(n \times n\)消为单位 ...

  10. kettle工具字符串替换

    原数据: 去掉括号内容(包括括号,或者替换为指定内容) 即可. 世界之大,这个东西,准确的说正则表达式,我搞了小半天!!!