千家信息网

Nginx启动脚本

发表于:2025-01-25 作者:千家信息网编辑
千家信息网最后更新 2025年01月25日,#!/bin/sh#nginx start script#Date:2017-6-21#Author:xcn(baishuchao@yeah.net)#version 2.0RETVAL=0path=
千家信息网最后更新 2025年01月25日Nginx启动脚本
#!/bin/sh#nginx start script#Date:2017-6-21#Author:xcn(baishuchao@yeah.net)#version 2.0RETVAL=0path="/application/nginx"#Source functions library. /etc/init.d/functionsstart(){if [ ! -f "$path/logs/nginx.pid" ] then    [ -x $path/sbin/nginx ]||exit 1    $path/sbin/nginx    RETVAL=$?    if [ -f $path/logs/nginx.pid ];then      action "Nginx startup" /bin/true    else      action "Nginx startup" /bin/false    fielse   echo "Nginx is running."fireturn $RETVAL} stop(){ if [ ! -f "$path/logs/nginx.pid" ] then   echo "nginx is not running.need not to stop it." else   [ -x $path/sbin/nginx ]||exit 1   [ -f "$path/logs/nginx.pid" ]&&{   kill `cat $path/logs/nginx.pid`   RETVAL=$?   }   if [ ! -f "$path/logs/nginx.pid" ];then     action "Nginx is stopped." /bin/true   else     action "Nginx is stopped." /bin/false   fifireturn $RETVAL} case "$1" in  start)        start        RETVAL=$?        ;;  stop)        stop        RETVAL=$?        ;;  restart)        $0 stop        sleep 2        $0 start        RETVAL=$?        ;;  reload)        $path/sbin/nginx reload        RETVAL=$?        ;;      *)        echo "USAGE:$0 {start|stop|restart|reload}"esacexit $RETVAL


0