Create upgrade-nginx-deb.sh

This commit is contained in:
tianyu 2016-04-27 10:04:19 +08:00
parent fa22c35a41
commit 106067c797
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#!/bin/bash
VERSION="1.10.0"
OLD_VERSION=$(nginx -v 2>&1|cut -d '/' -f 2)
wget https://www.xdty.org/dl/vps/nginx_$VERSION-1_amd64.deb -O nginx_$VERSION-1_amd64.deb
echo "Stop service ..."
service nginx stop
cd /etc || exit 1
if [ -d "nginx-$OLD_VERSION" ];then
mv "nginx-$OLD_VERSION" "nginx-$OLD_VERSION-$(date +%m%d)"
fi
mv nginx "nginx-$OLD_VERSION"
cd - || exit 1
dpkg -i nginx_"$VERSION"-1_amd64.deb
cd /etc || exit 1
mv nginx "nginx-$VERSION"
mv "nginx-$OLD_VERSION" nginx
echo "Start service ..."
service nginx start
echo "Done."