nginx启动脚本

<pre class="shell">#!/bin/bash

Nginx Start Nginx

chkconfig: - 85 15

description: The Nginx is an efficient web server

processname: Nginx

config: /usr/local/Nginx/conf/Nginx.conf

pidfile: /usr/local/Nginx/logs/Nginx.pid

##################################################

source function library.

. /etc/init.d/functions

RETVAL=0

base path

prog="Nginx"
binfile="/usr/local/Nginx/sbin/Nginx"
pidfile="/usr/local/Nginx/logs/Nginx.pid"
confile="/usr/local/Nginx/conf/Nginx.conf"
lockfile="/usr/local/Nginx/logs/Nginx.lock"

if [ ! -x $bindir ];then
echo -n "$bindir not installed! "

Tell the user this has skipped

exit 5

fi

start(){
test -e $pidfile && echo $"Already Starting $prog" && exit 6
echo -n $"Starting $prog:"
daemon $binfile -c $confile
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
echo
}

stop(){
echo -n $"Stopping $prog:"
killproc -p $pidfile $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
echo
}

case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
stop
sleep 2
start
RETVAL=$?
;;
reload)
$binfile -s reload
;;
status)
status $binfile
;;
version)
$binfile -v
;;
configtest)
$binfile -t
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|status|version|configtest}"
exit 2
;;
esac
exit $RETVAL

相关文章

一、Linux下Nginx的安装 1.去官网&#160;http://nginx.org/download/下载对应的Nginx安装包,推荐使...
一、空格:默认匹配、普通匹配 location / { root /home; } 二、= :精确匹配(表示匹配到 /home/resou...
``` nginx -c 配置文件路径 ``` ``` /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.con...
前言 nginx可所谓是如今最好用的软件级别的负载均衡了。通过nginx的高性能,并发能力强,占用内存下的特...
1.ngnix概念 Nginx是一款高性能的http 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。由俄...
博客园从今天上午就开始报502错误 , 他的原因还不知道 , 暂时先说下我们遇到502的排查情况 最大的可能性...