码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx启动脚本

时间:2018-05-25 11:09:00      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:Shell

注意你的nginx版本和存放路径,做相应的改动

#!/bin/bash

if [ $(ls /mnt | wc -l) -eq 0 ]; then
mount /dev/sr0 /mnt
fi
#declare totalNum=$(yum repolist | sed -n ‘/repolist/s/,//;s/repolist: //p‘)
declare totalNum=$(yum repolist | awk -F‘[: ]‘ ‘$1~/^repolist/{print $3}‘ | sed -n ‘s/,//p‘)

echo $totalNum

if [ $totalNum -eq 0 ]; then
echo "Please setup your yum first!!!"
exit
fi

if [ ! -d /usr/local/src/nginx-1.8.0 ]; then
tar xvz -f /tools/nginx-1.8.0.tar.gz -C /usr/local/src
fi

if [ -d /usr/local/nginx ];then
echo "you aleady install Nginx!!!"
exit
fi
declare -a yumList=‘gcc pcre-devel zlib-devel‘
for i in $yumList
do
if [ -z "$(rpm -qa $i)" ];then
yum -y install $i
fi
done

cd /usr/local/src/nginx-1.8.0
./configure --prefix=/usr/local/nginx 2>/scripts/nginx_install.log
make && make install 2>>/scripts/nginx_install.log

[ -d /usr/local/nginx ] && echo "install nginx sucessfully!!" || echo "install nginx fail!!!!"

Nginx启动脚本

标签:Shell

原文地址:http://blog.51cto.com/13765598/2120055

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!