#! /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

 

posted on 2017-08-24 11:26  网络终结者  阅读(216)  评论(0编辑  收藏  举报