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

nginx开机启动

时间:2017-08-24 12:30:13      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:reload   name   bin   code   rest   color   mon   tar   add   

#! /bin/bash
# chkconfig: - 85 15

DAEMON=/usr/local/nginx/sbin/nginx
CONFIGFILE=/usr/local/nginx/conf/nginx.conf
PIDFILE=/usr/local/nginx/nginx.pid


do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
$DAEMON -s stop || echo -n "nginx not running"
}
do_reload() {
$DAEMON -s reload || echo -n "nginx can‘t reload"
}
case "$1" in
start)
echo -n "Starting  nginx"
do_start
echo "."
;;
stop)
echo -n "Stopping  nginx "
do_stop
echo "."
;;
reload)
echo -n "Reloading nginx"
do_reload
echo "."
;;
restart)
echo -n "Restarting nginx"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0
chmod 755 /etc/init.d/nginx

chkconfig --add /etc/init.d/nginx

chkconfig nginx on

 

nginx开机启动

标签:reload   name   bin   code   rest   color   mon   tar   add   

原文地址:http://www.cnblogs.com/feiyun126/p/7422134.html

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