zoukankan      html  css  js  c++  java
  • nginx启动脚本

    #!/bin/bash
    . /etc/init.d/functions
    function usage() {
      echo $"usage:$0 {start|stop|restart}"
      exit 1
    }
    function start() {
      /usr/local/nginx/sbin/nginx
      sleep 1
      if [ `netstat -antlpe | grep nginx | wc -l` -ge 0 ];then
     action "nginx is started." /bin/true
      else
     action "nginx is started." /bin/false
      fi
    }
    function stop() {
      killall nginx &>/dev/null
      sleep 1
      if [ `netstat -antlpe | grep nginx | wc -l` -eq 0 ];then
     action "nginx is stopped." /bin/true
      else
     action "nginx is stopped." /bin/false
      fi
    }
    function main() {
      if [ $# -ne 1 ];then
     usage $0
      fi
      case $1 in
     start)
     start
     ;;
     stop)
     stop
     ;;
     restart)
     stop
     start
     ;;
     *)
     usage $0
     ;;
      esac
    }
    main $*
  • 相关阅读:
    内存相关函数
    Redis入门
    libevent(九)evhttp
    Python基础00 教程
    Python之re模块
    Makefile入门
    cmake安装jsoncpp
    awk调用date命令
    SQLite使用(二)
    SQLite使用(一)
  • 原文地址:https://www.cnblogs.com/donghui521/p/10334791.html
Copyright © 2011-2022 走看看