[root@localhost init.d]# cat nginx
#!/bin/bash
#nx Startup script for the Nginx HTTP Server # it is v.0.0. version. # chkconfig: - # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it's not for everyone. # processname: nginx # pidfile: /var/run/nginx/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/bin/nginx nginx_config=/etc/nginx/nginx.conf #nginx_pid=/var/run/nginx.pid
nginx_pid=/var/run/nginx/nginx.pid RETVAL= prog="nginx" # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit [ -x $nginxd ] || exit # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo "nginx already running...." exit fi echo -n $"Starting $prog: " daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = ] && touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $"Stopping $prog: " killproc $nginxd RETVAL=$? echo [ $RETVAL = ] && rm -f /var/lock/subsys/nginx /var/run/nginx/nginx.pid } # reload nginx service functions. reload() { echo -n $"Reloading $prog: " #kill -HUP `cat ${nginx_pid}` killproc $nginxd -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit esac exit $RETVAL

【shell脚本】nginx启动脚本的更多相关文章

  1. Shell脚本 - nginx启动脚本

    OS:CentOS/Redhat 系列 并在 Centos 6.7 和 Centos 7.2 上测试正常 #!/bin/bash # # auth: daxin # time: 2018/07/10 ...

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

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

  3. linux nginx 启动脚本

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

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

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

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

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

  6. 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/{ ...

  7. Nginx 启动脚本

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

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

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

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

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

  10. nginx启动脚本(class练习)

    说明:使用类的方式编写程序启动脚本(练习) 1 #!/usr/bin/env python import sys import os from subprocess import Popen,PIPE ...

随机推荐

  1. robotframework框架 - 在Pycharm当中编写RobotFramework测试用例

    众所周知,pycharm是个写python极好用的编辑器.也可以装很多的插件来完成各种骚操作. 某一天,心血来潮在pycharm的插件库里,搜索了一下robot,恩,发现有支持robotframewo ...

  2. Pipe——高性能IO(三)

    Pipelines可以替换掉那些丑陋的封装(kludge).变通(workaround)或妥协(compromise)——用一个在框架中设计优雅的专门的解决方案. 敢肯定,下面所覆盖的那些痛点,对于那 ...

  3. Java描述设计模式(07):适配器模式

    本文源码:GitHub·点这里 || GitEE·点这里 一.适配器模式简介 1.基础概念 适配器模式把一个类的接口变换成客户端所期待的另一种接口,从而使原本因接口不匹配而无法在一起工作的两个类能够在 ...

  4. window.innerHeight和document.documentElement.clientHeight区别

    今天有人问我这个问题,做了个小例子来记录一下子. 首先这两个都是获取可视区域的高度,那他们有什么区别呢 1.window.innerHeight属于BOM(浏览器对象模型),而document.doc ...

  5. 基于STM32F429,Cubemx的SAI音频播放实验

    书接上文:https://www.cnblogs.com/feiniaoliangtiangao/p/11060674.html 和 https://www.cnblogs.com/feiniaoli ...

  6. 根据excle说明文档建表

    在Excel里整理好的表模型数据,可直接导入PowerDesigner.此功能通过PowerDesigner的脚本功能来实现,使用起来也简单.具体操作方法:     打开PowerDesigner,新 ...

  7. PlayJava Day018

    今日所学: /* 2019.08.19开始学习,此为补档. */ File 文件或目录的抽象表示 public File(String parent , String child) 传入父目录地址,传 ...

  8. python爬虫网页解析之lxml模块

    08.06自我总结 python爬虫网页解析之lxml模块 一.模块的安装 windows系统下的安装: 方法一:pip3 install lxml 方法二:下载对应系统版本的wheel文件:http ...

  9. Format a Property Value 设置属性值的格式

    In this lesson, you will learn how to set a display format and an edit mask to a business class prop ...

  10. 平时代码中用不到设计模式?Are you kidding me?

    引子 平时我是个反应非常慢的人.有多慢呢?大概是两年前有次团队内部开会时,我听到同学说平时代码中用不到设计模式,我当时没有回答.两年后我终于反应过来了:“Are you kidding me?我每天都 ...