重启脚本:
#!/bin/bashPID=`cat /usr/local/nginx/logs/nginx.pid` >/dev/null 2>&1case $1 instart)/usr/local/nginx/sbin/nginx;;stop)kill -TERM $PID;;quit)kill -QUIT $PID;;reload)kill -HUP $PID;;restart)kill -TERM $PID/usr/local/nginx/sbin/nginx;;status)elinks http://localhost -dump >/dev/null 2>&1if [ $? -ne 0 ];thenecho "nginx stop"elseecho "nginx running"fiesac