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

    #!/bin/bash
    #chkconfig: 2345 30 88
    
    nginxd=/usr/local/nginx/sbin/nginx
    
    . /etc/init.d/functions
    res=`netstat -lntup | grep nginx|wc -l`
    
    start(){
            if [ $res -eq 0 ];then
                    $nginxd -c /usr/local/nginx/conf/nginx.conf
                    echo "nginx is starting"
                    if [ $? -eq 0 ];then
                            action "nginx is started." /bin/true
                    else
                            action "nginx is started." /bin/false
                    fi
            else
                    echo "nginx is running."
            fi
    }
    
    stop(){
            if [ $res -ge 1 ];then
                    $nginxd -s stop
                    echo "nginx is stopping"
                    if [ $? -eq 0 ];then
                            action "nginx is stopped." /bin/true
                    else
                            action "nginx is stopped." /bin/false
                    fi
            else
                    echo "nginx is not running."
            fi
    }
    
    restart(){
            if [ $res -ge 1 ];then
                    killall -9 nginx
                    action "nginx is stopped" /bin/true
                    $nginxd -c /usr/local/nginx/conf/nginx.conf
                    echo "nginx is starting."
                    if [ $? -eq 0 ];then
                            action "nginx is started." /bin/true
                    else
                            action "nginx is started." /bin/false
                    fi
            else
                    echo "ningx is not running."
            fi
    
    }
    
    case $1 in
            start)
                    start
                    ;;
            stop)
                    stop
                    ;;
            restart)
                    restart
                    ;;
            *)
                    echo $"Usage: $0 {start|stop|restart}"
                    exit 1
    esac
    exit

    将nginxd 加入启动项: chkconfig --add nginxd

  • 相关阅读:
    CSS 字体
    列表排列
    IE6 fixed 页面抖动
    HTML中css和js链接中的版本号(刷新缓存)
    CSS3 box-shadow
    CSS3的文字阴影—text-shadow
    [LeetCode][JavaScript]Add Digits
    [LeetCode][JavaScript]Max Points on a Line
    [LeetCode][JavaScript]Subsets II
    [LeetCode][JavaScript]Subsets
  • 原文地址:https://www.cnblogs.com/vincenshen/p/6595413.html
Copyright © 2011-2022 走看看