Shell Script Writing

Source: Internet
Author: User
Tags nginx reverse proxy

Automatic deployment, initial configuration, and start of Nginx reverse proxy service, automatic deployment, initial configuration, and launch of two Web

#!/bin/BashYum InstallEpel-release-yYum InstallNginx-yPSAux |grepNginx |grep-V'grep'if[$?-ne0 ]     Thensystemctl start Nginxfised-ri'/^http/a upstream xzhweb\{'/etc/nginx/nginx.confsed-ri'/^upstream/a Server 192.168.16.99'/etc/nginx/nginx.confsed-ri'/^server/a}'/etc/nginx/nginx.confsed-ri'/^server/a Server 192.168.16.175'/etc/nginx/nginx.confsed-ri'/^\ +location \/A proxy_pass http://xzhweb;'/etc/nginx/nginx.confsystemctl Stop Firewalldsetenforce0systemctl Restart Nginxif[$?-ne0 ]     Then       EchoWellcome to congratulationfi

192.168.16.27 for reverse proxy

Monitoring script: Monitor the memory usage of each machine >70%, then output alarm information

#! /bin/bashmem_used=` Free|awk 'Nr==2{print}'' Mem_total=` Free|awk 'Nr==2{print $}'' x=`Expr "scale=2, $mem _used/$mem _total"|bc-l |Cut-D.-F2 'if((x> -)); Then        Echo "Your memory is using the $x \%, please handle as soon as possible."    Else        Echo "Your memory usage is $x%, can are at ease use!"fi    

Shell Script Writing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.