WDCP Upgrade Tengine Scripts

Source: Internet
Author: User
Tags error handling

Upgrade Scripts

tengine_up.sh

The code is as follows Copy Code

#!/bin/bash
# tengine Upgrade Script 2014.3.3 (usage: SH tengine_up.sh, default version is 2.0.0, upgradeable nginx to Tengine)
Path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
Export PATH
# Check to see if the user is a root user
If [$ (id-u)!= "0"]; Then
Echo-e "33[31MN Error: You must be logged in as root to run this script 33[0m";
Exit 1
Fi
Clear
echo "========================================================================="
ECHO-E "33[31mtengine Upgrade script (upgradeable nginx to Tengine) 33[0m"
echo "========================================================================="
#选择升级nginx为tengine或升级tenginx版本号
#echo-E "33[32m1. Upgrade Nginx to Tengine
#2. Upgrade Tengine Version number
#请选择升级方式, the default upgrade Nginx is tengine:33[0m "; Read-t Way
#if ["$way" = "2"];then
#way = "2"
#else
#way = "1"
#fi
#选择升级的版本号, defaults to 2.0.0
Echo-e "33[32m Please enter version number, default is 2.0.0:33[0m"; Read-t ver
If ["$ver" = ""];then
Ver= "2.0.0"
Fi
Get_char ()
{
Savedstty= ' Stty-g '
Stty-echo
Stty Cbreak
DD If=/dev/tty Bs=1 count=1 2>/dev/null
Stty-raw
Stty Echo
Stty $SAVEDSTTY
}
Echo www.111cn.net
Echo-e "33[32m please press any key to start the upgrade tengine ... 33[0m "
Char= ' Get_char '
if [!-F/USR/BIN/GCC];then
Yum install-y gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel Libpng-dev El openssl-devel curl-devel patch libmcrypt-devel libmhash-devel ncurses-devel sudo bzip2
Fi
Wget-c http://tengine.taobao.org/download/tengine-$ver. tar.gz
[$?!= 0] && echo download error, upgrade failed!!! "&& exit
Tar zxvf tengine-$ver. tar.gz
CD tengine-$ver
./configure--user=www--group=www--prefix=/www/wdlinux/tengine-$ver--with-http_stub_status_module--with-http_ Ssl_module
[$!= 0] && echo configuration error, upgrade failed! "&& exit
Make
[$!= 0] && echo compilation error, upgrade failed! "&& exit
Make install
[$?!= 0] && echo installation error, upgrade failed! "&& exit
mv/www/wdlinux/tengine-$ver/conf/nginx.conf/www/wdlinux/tengine-$ver/conf/nginx.conf.default
Rm-rf/www/wdlinux/nginx/conf/nginx.conf.default
cp-pr/www/wdlinux/nginx/conf/*/www/wdlinux/tengine-$ver/conf/
Service Nginxd Stop
Rm-f/www/wdlinux/nginx
ln-sf/www/wdlinux/tengine-$ver/www/wdlinux/nginx
Sed-i '/limit_zone/d '/www/wdlinux/nginx/conf/nginx.conf
Service Nginxd Start
ECHO-E "33[32mtengine upgrade success 33[0m";
Echo-e "33[32m current version is: $ver 33[0m";

Error handling:
./configure:error:the HTTP Rewrite module requires the PCRE library.

Install pcre-devel solve problems

The code is as follows Copy Code
Yum-y Install Pcre-devel

Nginx hung up after the reboot.
nginx_lbw.sh

The code is as follows Copy Code

#!/bin/bash
Sed-i '/client_max_body_size/a
Limit_zone one $binary _remote_addr 32k; '/www/wdlinux/nginx/conf/nginx.conf
Rm-f nginx_lbw.sh

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.