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

nginx 启停脚本

时间:2014-08-13 19:30:00      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:nginx 启停脚本

#! /bin/sh
# chkconfig: 35 85 15
# description: This is nginx start and stop script

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DESC="nginx daemon"

NAME=nginx

DAEMON=/usr/sbin/$NAME

CONFIGFILE=/etc/nginx/$NAME.conf

PIDFILE=/var/run/nginx/$NAME.pid

SCRIPTNAME=/etc/rc.d/init.d/$NAME


 [ -x "$DAEMON" ] || exit 0

start() {
 $DAEMON -c $CONFIGFILE || echo -n "nginx already running"
 }

stop() {
 kill -INT `cat $PIDFILE` || echo -n "nginx not running"
 }

reload() {
 kill -HUP `cat $PIDFILE` || echo -n "nginx can‘t reload"
 }

case "$1" in
 start)
 echo -n "Starting $DESC: $NAME"
start
 echo "."
 ;;
 stop)
 echo -n "Stopping $DESC: $NAME"
 stop
 echo "."
 ;;
 reload|graceful)
 echo -n "Reloading $DESC configuration..."
 reload
 echo "."
 ;;
 restart)
 echo -n "Restarting $DESC: $NAME"
 stop
 start
 echo "."
 ;;
 *)
 echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
 exit 3
 ;;
 esac

exit 0

 

本文出自 “crush” 博客,请务必保留此出处http://only013.blog.51cto.com/6979724/1539424

nginx 启停脚本,布布扣,bubuko.com

nginx 启停脚本

标签:nginx 启停脚本

原文地址:http://only013.blog.51cto.com/6979724/1539424

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