- #!/bin/sh
- # chkconfig: 345 86 14
- # description: Startup and shutdown script for nginx
- 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
- #该片段来自于http://www.codesnippet.cn/detail/30112012761.html
来源: http://www.codesnippet.cn/detail/30112012761.html