#!/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. ubuntu下查看本机IP地址

    在终端输入: ifconfig -a 即可得解.出来的结果inet后就是你的ip地址

  2. PHP代码篇(二)-- array_column函数将二维数组格式化成固定格式的一维数组,及优化查询方法

    小白因为经常用到多表查询,比如获取一个会员领取的卡卷list,里面当然包含了1“会员优惠券记录表t_coupon_members”主表,然后2“门店优惠券表t_coupon”,和3“门店信息表t_sh ...

  3. 将Docker容器转移至另一服务器

    1 把当前的容器提交为一个镜像: docker commit 容器名 镜像名 2 将镜像存为tar文件 docker save 镜像名 >备份文件.tar 3将 备份文件.tar 复制到目的主机 ...

  4. Linux MySQL 开启远程访问

    进入mysql以后 use mysql; GRANT ALL ON *.* TO user@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

  5. RDPGuard6.1.7之后的问题

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

  6. (转)新建maven项目时报错Error:Maven Resources Compiler: Maven project configuration required for module 'XX'解决方法

    转载地址:https://blog.csdn.net/qq784515681/article/details/85070195 在新建maven项目时,Problems中报错: Error:Maven ...

  7. Pwn-Tell Me Something

    题目地址 https://dn.jarvisoj.com/challengefiles/guestbook.d3d5869bd6fb04dd35b29c67426c0f05 先看看位数 64位ELF ...

  8. 洛谷 P5595 【XR-4】歌唱比赛

    洛谷 P5595 [XR-4]歌唱比赛 题目传送门 题目描述 小 X 参加了一场歌唱比赛. 经过一路鏖战,小 X 终于挺进了决赛,他的对手是小 Y. 这场歌唱比赛的冠军是由点赞数决定的,谁的点赞数高, ...

  9. ESA2GJK1DH1K升级篇: 阿里云物联网平台 OTA: 关于阿里云物联网平台 OTA 的升级流程

    前言 鉴于有些用户直接想使用现成的物联网平台实现 OTA 远程升级 我就写一写这系列的文章 注意:首先大家必须把我自建服务器是如何实现的看明白! 我看了下阿里云提供的,实际上流程和咱自建实现的差别不大 ...

  10. 洛谷P3723 [AH2017/HNOI2017]礼物

    吴迪说他化学会考上十分钟就想出来了,太神了%%%不过我也十分钟 但是调了一个多小时啊大草 懒得人话翻译了,自己康吧: 我的室友(真的是室友吗?)最近喜欢上了一个可爱的小女生.马上就要到她的生日了,他决 ...