#!/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. .net连接Oracle

    通过网上了解到.net连接Oracle主要有3种方法.(1)System.Data.OracleClient微软的System.Data.OracleClient可以直接引用,但是VS会提示“Syst ...

  2. 记一次接口调试错误: {"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson

    接口测试中用postman测试返回是正常的,但是使用其他人去调用就出错了,找了半天,才想起来使用了nginx,用于端口的代理转发.然后根据错误信息发现json格式的某个字段为null,结合日志中的报文 ...

  3. Lnmp架构部署动态网站环境.2019-7-3-1.2

    Nginx安装 一.安装准备 Pcre(Perl Compatible Regular Expressions,兼容正则表达式)安装pcre库是为了使Nginx支持HTTP Rewrite模块. 安装 ...

  4. RDPGuard6.1.7之后的问题

    RDPGuard是一款保护远程桌面RDP端口不被暴力猜解的软件,说下在使用RDP Guard中遇到的一些问题: 1.似乎D版RDPGuard 6.1.7或之后的版本,启用IP Cloud会自动将大量I ...

  5. nginx目录详解

  6. 01-路由跳转 安装less this.$router.replace(path) 解决vue/cli3.0语法报错问题

    2==解决vue2.0里面控制台包的一些语法错误. https://www.jianshu.com/p/5e0a1541418b 在build==>webpack.base.conf.j下注释掉 ...

  7. jmeter连接不上MySQL数据库的原因以及解决方法

    1.Cannot create PoolableConnectionFactory (Client does not support authentication protocol requested ...

  8. lua 15 协程-协同程序

    转自:http://www.runoob.com/lua/lua-coroutine.html 什么是协同(coroutine)? Lua 协同程序(coroutine)与线程比较类似:拥有独立的堆栈 ...

  9. MySQL SQL DLL (数据定义语言)

    CREATE CREATE DATABASE CREATE DATABASE 用于创建数据库 CREATE DATABASE new_database_name; CREATE TABLE CREAT ...

  10. WinSxS目录下文件的清除

    1)McAfee Scanner service 持续高cpu 2)上网查到了,需要看 %deflogdir%目录下的OnDemandScan_Activity.log 3) 打开这个文件,发觉一直在 ...