启动脚本
#!/bin/bashWORK_DIR=/data/nginxCOMM_DIR=$WORK_DIR/sbin/nginxNAME=nginxPID=$WORK_DIR/logs/nginx.pidstart() {if [ -f $PID ];then echo "nginx is running"else$COMM_DIR if [ -f $PID ]; then echo "nginx is started" exit 0 else echo "nginx start is bad" exit 1 fifi}stop() {if [ -f $PID ]; then $COMM_DIR -s stop echo "nginx is stoped" else echo "nginx: [error] open() "/data/nginx/logs/nginx.pid" failed (2: No such file or directory)" exit 1fi }restart() {if [ ! -f $PID ]; then echo "nginx: [error] open() "/data/nginx/logs/nginx.pid" failed (2: No such file or directory)" else $COMM_DIR -s stop sleep 3 $COMM_DIRfi}reload() {if [ ! -f $PID ]; then echo "nginx: [error] open() "/data/nginx/logs/nginx.pid" failed (2: No such file or directory)" else $COMM_DIR -s reloadfi}chk() {if [ ! -f $PID ] then echo "nginx: [error] open() "/data/nginx/logs/nginx.pid" failed (2: No such file or directory" else $COMM_DIR -tfi}case $1 instart) start;;stop) stop;;restart) restart;;reload) reload;;chk) chk;;*)echo "Usage:$0 {start|stop|restart|reload|ehk}";;esac