Shell脚本-自动化部署反向代理、WEB、nfs
部署nginx反向代理三个web服务,调度算法使用加权轮询(由于物理原因只开启两台服务器)
AutoNginxNfsService.sh
#/bin/bash
systemctl status nginx
if(($?==))
then
yum install -y nginx
if(($?==))
then
#echo 'Yes!'
systemctl start nginx
if(($?==))
then
echo "Congratulations!! Nginx start OK!!"
else
echo "Sorry is Fail!!!"
fi
else
echo"sorry install is Fail!!!" fi
elif(($?==))
then
systemctl start nginx
if(($?==))
then
echo "Congratulations!! Nginx start OK!!!"
else
echo "sorry!!"
fi
elif(($?==))
then
echo "OKOKOK!!!"
else
echo "I am so sorry"
fi
echo "config writing...."
grep 'upstream' /etc/nginx/nginx.conf
if(($?!=))
then
sed -ri '/^http/a upstream Yanlong {' /etc/nginx/nginx.conf
sed -ri '/^upst/a server yanlongweb1 weight=3\;' /etc/nginx/nginx.conf
sed -ri '/^server yanlongweb1/a server yanlongweb2\;' /etc/nginx/nginx.conf
sed -ri '/^server yanlongweb2/a \}' /etc/nginx/nginx.conf
sed -ri '/^(\ +)(location)(\ )(\/)/a proxy_pass http:\/\/Yanlong\;' /etc/nginx/nginx.conf
fi
echo "config write is OK!"
systemctl reload nginx
if(($?==))
then
echo "HTTP load balancer is OK!"
else
echo "Sorry!!"
fi
systemctl status nfs
if(($?==))
then
yum install rpcbind nfs-utils -y
if(($?==))
then
#echo 'Yes!'
systemctl start nfs
if(($?==))
then
echo "Congratulations!! nfs start OK!!"
else
echo "Sorry is Fail!!!"
fi
else
echo"sorry install is Fail!!!" fi
elif(($?==))
then
systemctl start nfs
if(($?==))
then
echo "Congratulations!! nfs start OK!!!"
else
echo "sorry!!"
fi
elif(($?==))
then
echo "OKOKOK!!!"
else
echo "I am so sorry"
fi
echo "config writing...."
echo "/webindex 192.168.16.0/24(rw,sync,fsid=0)" > /etc/exports
echo "config write is OK!"
systemctl reload nfs
if(($?==))
then
echo "NFS service is OK!"
else
echo "Sorry!!"
fi
所有web服务使用共享存储nfs,保证所有web都对其有读写权限,保证数据一致性
#/bin/bash
systemctl status nginx
if(($?==))
then
yum install -y nginx
if(($?==))
then
#echo 'Yes!'
systemctl start nginx
if(($?==))
then
echo "Congratulations!! Nginx start OK!!"
else
echo "Sorry is Fail!!!"
fi
else
echo"sorry install is Fail!!!" fi
elif(($?==))
then
systemctl start nginx
if(($?==))
then
echo "Congratulations!! Nginx start OK!!!"
else
echo "sorry!!"
fi
elif(($?==))
then
echo "OKOKOK!!!"
else
echo "I am so sorry"
fi
echo "config writing...."
sed -ri '/^(\ +)(location)(\ )(\/)/a root\ \/nginxwebservice\;' /etc/nginx/nginx.conf
sed -ri '/^root\ \/nginxwebservice/a index\ web.html\;' /etc/nginx/nginx.conf
echo "config write is OK!"
systemctl reload nginx
if(($?==))
then
echo "HTTP load balancer YanlongWEBservice is OK!"
else
echo "Sorry!!"
fi
systemctl status nfs
if(($?==))
then
yum install rpcbind nfs-utils -y
if(($?==))
then
#echo 'Yes!'
systemctl start nfs
if(($?==))
then
echo "Congratulations!! nfs start OK!!"
else
echo "Sorry is Fail!!!"
fi
else
echo"sorry install is Fail!!!" fi
elif(($?==))
then
systemctl start nfs
if(($?==))
then
echo "Congratulations!! nfs start OK!!!"
else
echo "sorry!!"
fi
elif(($?==))
then
echo "OKOKOK!!!"
else
echo "I am so sorry"
fi
echo "config writing...."
mount -t nfs 192.168.16.120:/webindex/ /nginxwebservice/
echo "config write is OK!"
systemctl reload nfs
if(($?==))
then
echo "NFS service is OK!"
else
echo "Sorry!!"
fi
Shell脚本-自动化部署反向代理、WEB、nfs的更多相关文章
- shell脚本安装部署反向代理 监控进程 计划任务
1.编写脚本自动部署反向代理.web.nfs: 要求: I.部署nginx反向代理三个web服务,调度算法使用加权轮询: 反向代理服务器脚本配置脚本 #!/bin/bash #安装eple和nginx ...
- shell脚本自动化部署服务
shell脚本自动化部署 !/bin/bash #export PATH=$PATH:/export/maven/bin run_flag_dir="/data0/shell/deploy_ ...
- shell脚本自动化部署
由于公司技术部团队较小,没有专门的运维团队,所以运维工作技术部承包了. 一.纯人工部署是这样的: 1. 本地打包:一般 maven clean package 2. 借助xftp上传到服务器对应目录 ...
- linux下使用shell脚本自动化部署项目
在Java开发项目时经常要把正在开发的项目发布到测试服务器中去测试,一般的话是要把项目先打成war包,然后把war包发布到服务器中,关闭服务器, 最后重新启动服务器,虽然这过程不是很繁琐,但如果是多个 ...
- 编写脚本自动部署反向代理、web、nfs
服务器端 #!/bin/bash function nginx_install(){ if [[ -f /usr/sbin/nginx ]]; then echo 'Nginx has been in ...
- Shell脚本-自动化部署WEB
#! /bin/ ] then echo "#### 参数有误,\$1:构建号必填" exit fi cd /root/workspace/xinya_erp/xinya_web ...
- shell脚本自动化部署Zabbix4.2(修改脚本替换版本)
#!/bin/bash # 检查操作系统版本,该脚本只能运行在 Centos 7.x 系统上 cat /etc/redhat-release |grep -i centos |grep '7.[[:d ...
- shell脚本自动化部署XX的案例(附数组使用)
#!/bin/sh #Auto Make install MFS Files # cat <<EOF ++++++++++++++++Welcome To Use Auto Install ...
- 脚本自动部署及监控 web
1.编写脚本自动部署反向代理.web.nfs: I.部署nginx反向代理两个web服务,调度算法使用加权轮询 II.所有web服务使用共享存储nfs,保证所有web都对其有读写权限,保证数据一致性: ...
随机推荐
- CSS 绝对定位与弹性布局合作居中
position: absolute; display:flex; justify-content:center;align-items:center;
- 浅谈JavaScript预编译原理
这两天又把js的基础重新复习了一下,很多不懂得还是得回归基础,大家都知道js是解释性语言,就是编译一行执行一行,但是在执行的之前,系统会做一些工作: 1,语法分析: 2,预编译: 3,解释执行. 语法 ...
- Springboot+Thymeleaf框架的button错误
---恢复内容开始--- 在做公司项目时,遇到了一个Springboot+Thymeleaf框架问题: 使用框架写网站时,没有标明type类型的button默认成了‘submit’类型,每次点击按钮都 ...
- Distinct Substrings SPOJ - DISUBSTR(后缀数组水题)
求不重复的子串个数 用所有的减去height就好了 推出来的... #include <iostream> #include <cstdio> #include <sst ...
- swift网络数据请求方法
搭建一个apache服务器,用php编写一个返回给客户端请求数据的脚本 <?php // header("Content-type:text/html;charset=utf-8&qu ...
- Libssh认证绕过CVE-2018-10933漏洞复现
0x00 漏洞描述 libssh 0.6 及以上的版本,在服务端的代码实现中存在身份认证绕过漏洞.在向服务端认证的流程中,攻击者通过将 SSH2_MSG_USERAUTH_REQUEST 消息替换为 ...
- bzoj 2732 射箭 半平面交
2732: [HNOI2012]射箭 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 2531 Solved: 848[Submit][Status] ...
- 使用JS在textarea在光标处插入内容
// 在光标处插入字符串 // myField 文本框对象 // myValue 要插入的值 function insertAtCursor(myField, myValue) { //IE supp ...
- QNX下进程间通信
https://blog.csdn.net/dh314552189/article/details/87879016 server.cpp #include <stdlib.h> #inc ...
- Razor:从aspx到cshtml常见错误及正确书写方法
http://blog.csdn.net/cheny_com/article/details/6298496 从aspx转到chshtml还是有很多要适应的地方的,本帖是个人学习笔记帖不断更新.每天开 ...