#!/bin/sh

#

# nginx - this script starts and stops the nginx daemin

#

# chkconfig:   - 85 15

# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \

#               proxy and IMAP/POP3 proxy server

# processname: nginx

# config:      /etc/nginx/nginx.conf

# pidfile:     /usr/local/nginx/logs/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/nginx/sbin/nginx"

prog=$(basename $nginx)

NGINX_CONF_FILE="/etc/nginx/nginx.conf"

lockfile=/var/lock/subsys/nginx

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

echo -n $"Starting $prog: "

daemon $nginx -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $"Stopping $prog: "

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

sleep 1

return $retval

}

restart() {

configtest || return $?

stop

start

}

reload() {

configtest || return $?

echo -n $"Reloading $prog: "

killproc $nginx -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status >/dev/null 2>&1

}

case "$1" in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-

reload|configtest}"

exit 2

esac

# chmod 755 /etc/init.d/nginx

# chkconfig --add nginx

# service nginx start

# chkconfig nginx on

最新文章

  1. zend studio 13.5破解以及集成xdebug
  2. DELETE与TRUNCATE的区别
  3. HTTP 协议的历史演变和设计思路
  4. [C++]C++标准里 string和wstring
  5. 不相交集(The Disjoint Set ADT)
  6. 成为JavaGC专家(2)—如何监控Java垃圾回收机制
  7. 还是把一个课程设计作为第一篇文章吧——学生学籍管理系统(C语言)
  8. 转发——推荐一些国外高质量Java开发者的博客
  9. Vim键盘布局
  10. 经典dp 最长公共子序列
  11. hdu4463 Outlets 最小生成树
  12. MySQL单表查询
  13. python 接口自动化测试(五)其他-认证&代理&超时配置
  14. 手把手教你如何用eclipse搭建前端开发环境
  15. 将 Azure VM 迁移到 Azure 中的托管磁盘
  16. Unable to execute dex: Multiple dex files defineLcom/google/gson/JsonDeserializer;
  17. luogu1072 [NOIp2009]Hankson的趣味题 (数学+STL::set)
  18. 字体选择框QFontComboBox
  19. webgl之观察三维空间
  20. Extending Conductor

热门文章

  1. Dictionary和Hashtable的一些异同
  2. Unix调试工具dbx使用方法
  3. nodejs require
  4. machine learning 笔记 normal equation
  5. ajax回调打开新窗体防止浏览器拦截有效方法
  6. .Net“/”应用程序中的服务器错误 超过了最大请求长度 错误解决办法
  7. cdnbest节点安装后连不上主控常见问题
  8. linux学习笔记——基础命令
  9. SpringMVC的controller方法上若需要参数 如User
  10. Failed opening .rdb for saving: Permission denied