#!/bin/sh # chkconfig: 345 86 14 # description: 启动,重启,停止nginx的shell脚本 NGINX_DIR=/opt/ngx export NGINX_DIR case $1 in 'start' ) echo "Starting nginx..." $NGINX_DIR/sbin/nginx ;; 'reload' ) echo "Reload nginx configuration..." kill -HUP `cat $NGINX_DIR/logs/nginx.pid` ;; 'stop' ) echo "Stopping nginx..." kill -15 `cat $NGINX_DIR/logs/nginx.pid` ;; 'list' ) ps aux | egrep '(PID|nginx)' ;; 'testconfig' ) $NGINX_DIR/sbin/nginx -t ;; *) echo "usage: `basename $0` {start|reload|stop|list|testconfig}" esac