Welcome 微信登录

首页 / 操作系统 / Linux / Nginx作为Linux系统服务启动

#!/bin/bash
# chkconfig: 2345 58 74
# description: nginx web server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/log/nginx.pid
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
if [ -f /etc/sysconfig/nginx ];then
. /etc/sysconfig/nginx
fi
RETVAL=0
prog=”nginx”
start() {
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 1
echo -n $”Starting $prog: ”
daemon /usr/local/nginx/sbin/nginx $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
stop() {
echo -n $”Shutting down $prog: ”
killproc /usr/local/nginx/sbin/nginx
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nginx
return $RETVAL
}# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status nginx
RETVAL=$?
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/nginx ]; then
stop
start
RETVAL=$?
fi
;;
*)
echo $”Usage: $0 {start|stop|restart|condrestart|status}”
RETVAL=3
esac
exit $RETVALLinux下route命令的输出信息的一些解释在自己的计算机上安装Chrome OS相关资讯      Nginx 
  • Nginx和Nginx+的比较  (01月02日)
  • 使用 Ansible 安装 NGINX 和 NGINX  (10/08/2015 13:01:17)
  • 如何使用 Datadog 监控 Nginx(第  (08/25/2015 14:00:05)
  • 你应该了解Nginx的7个原因  (11/09/2015 11:20:48)
  • Nginx-1.9.5 开发版已发布下载,支  (09/23/2015 07:35:56)
  • NGINX 初期 Alpha 版 HTTP/2 模块   (08/15/2015 19:43:22)
本文评论 查看全部评论 (0)
表情: 姓名: 字数