shell脚本实现自动化安装linux版本的loadrunner agent(centos6.8)
#!/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)的更多相关文章
- Shell脚本,自动化发布tomcat项目【转载】
Shell脚本,自动化发布tomcat项目脚本. 1. vko2c_auto_build_by_scp.sh 文件内容: #---------------------start------------ ...
- Shell脚本,自动化发布tomcat项目【转】
Shell脚本,自动化发布tomcat项目脚本. 1. vko2c_auto_build_by_scp.sh 文件内容: #---------------------start------------ ...
- Linux Shell脚本编程--Linux特殊符号大全
Linux Shell脚本编程--Linux特殊符号大全 linux_shell 特殊符号的介绍 2011
- [linux] shell脚本编程-xunsearch安装脚本学习
安装脚本setup.sh #!/bin/sh # FULL fast install/upgrade script # See help message via `--help' # $Id$ # s ...
- 脚本实现自动化安装lamp&lnmp
#备注:前提是将lnmp和lnmp自动化脚本写好放在相应的路径, 脚本已写好,请查看我博客中的 shell脚本 专栏! #!/bin/bash #安装lamp或者lnmp path=/server/s ...
- 进阶!基于CentOS7系统使用cobbler实现单台服务器批量自动化安装不同版本系统(week3_day5_part2)-技术流ken
前言 在上一篇博文<cobbler批量安装系统使用详解-技术流ken>中已经详细讲解了cobbler的使用以及安装,本篇博文将会使用单台cobbler实现自动化批量安装不同版本的操作系统. ...
- cobbler单台服务器实现批量自动化安装不同版本系统-技术流ken
前言 在上一篇博文<cobbler批量安装系统使用详解-技术流ken>中已经详细讲解了cobbler的使用以及安装,本篇博文将会使用单台cobbler实现自动化批量安装不同版本的操作系统. ...
- ansible配合shell脚本批量编译安装python3.6.6
[root@node1:/etc]# tree /etc/ansible/ /etc/ansible/ ├── ansible.cfg ├── hosts ├── python.yml └── rol ...
- 使用shell脚本来自动化处理我们的工作,解放双手
Shell脚本介绍 1.Shell脚本,就是利用Shell的命令解释的功能,对一个纯文本的文件进行解析,然后执行这些功能,也可以说Shell脚本就是一系列命令的集合. 2.Shell可以直接使用在wi ...
随机推荐
- Wireshark使用教程:不同报文颜色的含义
- 设置 色彩规则有两个入口,一个在报文上方的工具栏内,如图: 那个鲜艳的图标就是色彩规则的入口. 另一个是view-->coloring rules菜单. 点击进去即可看见所有的色彩规则的设置 ...
- 第三方库Mantle的简单实用
1. 测试时, 可以使用下面这个网址及代码来测试, 里面有模型,数组,以及字典, 还可以有long long 转NSDate, string 转 int等. NSURL *url = [NSURLU ...
- 如何开发优质的 Flutter App:Flutter App 软件测试指南
继上一场GitChat文章发布之后,博主又为朋友们带来另一场Chat.这一次我们主要聊一聊Flutter App的测试环节. 众所周知,应用的功能越多,手动测试的难度就越大.一套完整的自动化测试将帮助 ...
- 阿里云centos7安装python3.7.4和pip3
亲测有效,针对 阿里云 centos 7 轻量服务器 python ==> 3.7.4 pip ==> 3 一,打开python官网,找到下载Python的tgz文件,有两种方式下载 ( ...
- [20190531]建立job与commit.txt
[20190531]建立job与commit.txt --//昨天看链接:https://connor-mcdonald.com/2019/05/28/dbms_job-the-joy-of-tran ...
- wsl笔记
目录 环境 修改更新源 新建用户 设置超级用户 环境变量 zsh美化终端 设zsh为默认shell 环境变量PATH 开启 ssh 远程连接 apt命令与问题 windows 和 wsl 互相访问文件 ...
- win10 anaconda3 python3.6安装tensorflow keras tensorflow_federated详细步骤及在jupyter notebook运行指定的conda虚拟环境
本文链接:https://blog.csdn.net/weixin_44290661/article/details/1026789071. 安装tensorflow keras tensorflow ...
- 学习CNN系列一:原理篇
CNN的发展历程: 1962年,卷积神经网络的研究起源于Hubel和Wiesel研究毛脑皮层的发现局部互连网络可以有效降低反馈神经网络的复杂性. 1980年,CNN的第一个实现网络:Fukushima ...
- js修改对象的key值
var array = [ { id:1, name:"小明" }, { id:2, name:"小红" } ]; /**/ //旧key到新key的映射 va ...
- else if 使用注意
写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数.不区分大小写. 例如:输入:ABCDE A 输出:1 错误代码如下: #include < ...