nginx 시작, 정지, 스 크 립 트 다시 불 러 오기

6122 단어
#!/bin/bash
nginx=/usr/local/nginx/sbin/nginx
read -ep "           (start|stop|reload|status):" asb
case $asb in
        #   nginx
        start)
        #  nginx    
        netstat -anpt |grep nginx &> /dev/null
        if [ $? -eq 0 ];then
                echo "nginx     "
        else
                echo "nginx     "
                echo "    "
                $nginx
        fi
        ;;
        #  nginx  
        stop)
        netstat -anpt |grep nginx &> /dev/null
        if [ $? -eq 0 ];then
                $nginx -s stop
                echo "nginx     "
        else
                echo "nginx     "
        fi
        ;;
        #nginx    
        status)
        netstat -anpt |grep nginx &> /dev/null
        if [ $? -eq 0 ];then
                echo "nginx     "
        else
                echo "nginx    "
        fi

        ;;
        #  nginx    
        reload)
        netstat -anpt |grep nginx &> /dev/null
        if [ $? -eq 0 ];then
                $nginx -s reload
                echo "   nginx  "
        else
                echo "nginx     ,  nginx"
                $nginx &> /dev/null
                netstat -anpt |grep nginx &> /dev/null
                if [ $? -eq 0 ];then
                        $nginx -s reload
                        echo "   nginx  "
                else
                        echo "    "
                fi

        fi

        ;;
        *)
        echo "    !      "
        ;;
esac
                                   

좋은 웹페이지 즐겨찾기