• shell脚本自动部署nignx反向代理及web服务器,共享存储


    #!/bin/bash

    systemctl status nginx var
    =$? if [ $var -eq 4 ] then yum install epel-release -y if [$? -ne 0 ] then echo "epel库安装失败,无可用nginx源" else yum install nginx -y if [ $? -eq 0 ] then systemctl start nginx if [ $? -eq 0 ] then echo "nginx start ok" else echo "nginx start fail" fi else echo "nginx install fail" fi fi elif [ $var -eq 3 ] then systemctl start nginx if [ $? -eq 0 ] then echo "nginx start ok" else echo "nginx start fail" fi elif [ $var -eq 0 ] then echo "nginx is OK" else echo "nginx can't be installed" fi echo "修改配置文件" grep 'upstream' /etc/nginx/nginx.conf if(($? != 0)) then sed -ri '/^http/a upstream pythonweb {' /etc/nginx/nginx.conf sed -ri '/^upst/a server 192.168.211.136 weight=3;' /etc/nginx/nginx.conf sed -ri '/^server 192.168.211.136/a server 192.168.211.137;' /etc/nginx/nginx.conf sed -ri '/^server 192.168.211.137/a server 192.168.211.138;' /etc/nginx/nginx.conf sed -ri '/^server 192.168.211.138/a }' /etc/nginx/nginx.conf sed -ri '/^( +)(location)( )(/)/a proxy_pass http://pythonweb;' /etc/nginx/nginx.conf fi echo "配置文件修改成功" echo "重新加载nginx" systemctl reload nginx if(($?==0)) then echo "HTTP load balancer is OK!" else echo "Sorry!!" fi systemctl status nfs-server var1=$? if(($var1==4)) then yum install rpcbind nfs-utils -y if(($?==0)) then systemctl start rpcbind nfs-server if(($?==0)) then echo "Congratulations!! nfs start OK!!" else echo "Sorry is Fail!!!" fi else echo"sorry install is Fail!!!" fi elif(($var1==3)) then echo "nfs-server未执行" systemctl start rpcbind nfs-server if(($?==0)) then echo "Congratulations!! nfs start OK!!!" else echo "sorry!!" fi elif(($var1==0)) then echo "OKOKOK!!!" else echo "I am so sorry" fi echo "修改配置文件" test -d /share if [ $? != 0 ] then mkdir /share chmod -R 777 /share fi echo "/share 192.168.16.0/24(rw,sync,fsid=0)" > /etc/exports echo "配置文件修改成功" echo "重新加载nfs-server" systemctl reload nfs-server if(($?==0)) then echo "NFS service is OK!" else echo "Sorry!!" fi
  • 相关阅读:
    Sentinel实现熔断和限流
    Nacos 服务注册和配置中心
    SpringCloud Sleuth 分布式请求链路跟踪
    SpringCloud Stream消息驱动
    SpringCloud Bus消息总线
    SpringCloud Config分布式配置中心
    Geteway服务网关
    Hystrix断路器
    libecc:一个可移植的椭圆曲线密码学库
    第四十二个知识点:看看你的C代码为蒙哥马利乘法,你能确定它可能在哪里泄漏侧信道路吗?
  • 原文地址:https://www.cnblogs.com/stin/p/7846189.html
Copyright © 2020-2023  润新知