#!/bin/bash
# nginx update scripts
# url http://pp.gy
# author pp.gy

if [ ! $1 ];then
	ver="1.2.3"
else
	ver=$1
fi

cd /tmp
wget -c http://pp.gy/i386/nginx-$ver-1.el5.ngx.i386.rpm
[ $? != 0 ] && echo "down err" && exit
rpm -ivh nginx-$ver-1.el5.ngx.i386.rpm
mv /www/wdlinux/nginx-$ver/conf/nginx.conf /www/wdlinux/nginx-$ver/conf/nginx.conf.default
cp -pR /www/wdlinux/nginx/conf/* /www/wdlinux/nginx-$ver/conf/
service nginxd stop
rm -f /www/wdlinux/nginx
rm -f /www/wdlinux/nginx-$ver/conf/nginx.conf
ln -sf /www/wdlinux/nginx-$ver /www/wdlinux/nginx
wget -c http://pp.gy/i386/nginx.conf
cp nginx.conf /www/wdlinux/nginx-$ver/conf
service nginxd start
echo
echo "Nginx Update Is OK"
echo "Current Ver Is:$ver"
echo