#!/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: /usr/local/nginx/conf/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="/usr/local/nginx/conf/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 
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

redhat nginx 启动脚本的更多相关文章

  1. linux nginx 启动脚本

    linux nginx 启动脚本 [root@webtest76 ~]# vi /etc/init.d/nginx #!/bin/bash # nginx Startup script for the ...

  2. Nginx 启动脚本/重启脚本

    第一步先运行命令关闭nginx sudo kill `cat /usr/local/nginx/logs/nginx.pid` 第二步 vi /etc/init.d/nginx 输入以下内容 #!/b ...

  3. nginx启动脚本,手动编辑

    nginx启动脚本,手动编辑 #! /bin/bash # chkconfig: - # description: nginx service XDIR=/www/server/nginx DESC= ...

  4. centos LNMP第一部分环境搭建 LAMP LNMP安装先后顺序 php安装 安装nginx 编写nginx启动脚本 懒汉模式 mv /usr/php/{p.conf.default,p.conf} php运行方式SAPI介绍 第二十三节课

    centos  LNMP第一部分环境搭建 LAMP安装先后顺序  LNMP安装先后顺序 php安装 安装nginx  编写nginx启动脚本   懒汉模式  mv   /usr/local/php/{ ...

  5. Nginx 启动脚本

    Nginx 启动脚本 1.vim /etc/init.d/nginx #!/bin/bash # chkconfig: - 30 21 # description: http service. # S ...

  6. LNMP 1.4 nginx启动脚本和配置文件

    编写Nginx启动脚本,写入下面这段,授权755 vim /etc/init.d/nginx #!/bin/bash # chkconfig: - # description: http servic ...

  7. shell脚本之nginx启动脚本、统计日志字段、for循环实战、跳板机

    1.NGINX启动脚本 #!/bin/bash # chkconfig: 235 32 62 # description: nginx [ -f /etc/init.d/functions ] &am ...

  8. nginx启动脚本和配置文件

    1.编写Nginx启动脚本,并加入系统服务 vim /etc/init.d/nginx并在其中写入如下内容:#!/bin/bash# chkconfig: - 30 21# description: ...

  9. 开发nginx启动脚本及开机自启管理(case)

    往往我们在工作中需要自行写一些脚本来管理服务,一旦服务异常或宕机等问题,脚本无法自行管理,当然我们可以写定时任务或将需要管理的脚本加入自启等方法来避免这种尴尬的事情,case适用与写启动脚本,下面给大 ...

随机推荐

  1. Dragon Balls(hdu3635带权并查集)

    题意:n个城市有n个龙珠,T  a,b 代表将龙珠a移动到b城市,Q a代表查询龙珠a所在城市,该城市有多少颗龙珠,该龙珠移动了多少次. 注意:移动时是将龙珠所在该城市所有龙珠都移动,每个龙珠不会再回 ...

  2. gsoap:实现线程池处理时获取到客户端的ip

    问题: 在使用线程池处理客户端请求时发现不能获取到客户端的ip! 原因:     由于在server_loop注循环中只把连接字sock加到queue队列中,并没有客户端IP,所以每一次queue回调 ...

  3. [基础]RHEL6下LINUX服务器批量部署

      包准备:xinetd,tftp-server,dhcp,httpd,system-config-kickstart,syslinux,nfs   试验环境: 本机地址:192.168.46.98 ...

  4. Android 点击桌面快捷方式和Notifycation跳转到Task栈顶Activity

    我们一般下载的应用在第一次启动应用的时候都会给我创建一个桌面快捷方式,然后我在网上找了些资料整理下了,写了一个快捷方式的工具类,这样我们以后要创建快捷方式的时候直接拷贝这个类,里面提供了一些静态方法, ...

  5. 使用ThreadGroup模拟线程池

    参考文章: [1]创建线程池 http://sunnylocus.iteye.com/blog/223327?page=2#comments [2]线程组ThreadGroup  http://hub ...

  6. 制作类似ThinkPHP框架中的PATHINFO模式功能(二)

    距离上一次发布的<制作类似ThinkPHP框架中的PATHINFO模式功能>(文章地址:http://www.cnblogs.com/phpstudy2015-6/p/6242700.ht ...

  7. UITabelview的删除

    删除的效果 Automatic Bottom Fade left middle none right top 简单删除 先删除数据源里的数据,然后再删除cell,否者会报错 let indexPath ...

  8. 隐藏或删除指定的html元素

    <div  id="Contain"> <div>好好学习<div> <div>天天向上<div> <div> ...

  9. U3D简单得换装技术

    四个类完成,前提是 资源得名字配合 UI按钮点击响应类 using UnityEngine; using System.Collections; public class ButtonClickHan ...

  10. 想要见识外太空?一款VR头显就能帮你实现梦想

    除了宇航员,我们中的大多数人一生都没有机会前往地球之外的宇宙空间,只能在图片和纪录片中感受浩瀚宇宙的震撼. 美国肯尼迪航天中心和BrandVR合作推出的VR头显 而NASA在VR中的投资,创造的新的V ...