nginx启动脚本

前端之家收集整理的这篇文章主要介绍了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

猜你在找的Nginx相关文章