1. #!/bin/sh
    2. # chkconfig : 345 86 14
    3. # description:
    4. NGINX_DIR=/usr/local/nginx
    5. export NGINX_DIR
    6. case $1 in
    7. 'start')
    8. echo "start nginx...."
    9. $NGINX_DIR/sbin/nginx
    10. ;;
    11. 'reload')
    12. echo "Reload nginx configuration...."
    13. kill -HUP `cat $NGINX_DIR/logs/nginx.pid`
    14. ;;
    15. 'stop')
    16. echo "stopping nginx...."
    17. kill -15 `cat $NGINX_DIR/logs/nginx.pid`
    18. ;;
    19. 'list')
    20. ps aux | egrep '(PID|nginx)'
    21. ;;
    22. 'testconfig')
    23. $NGINX_DIR/sbin/nginx -t
    24. ;;
    25. 'version')
    26. $NGINX_DIR/sbin/nginx -v
    27. ;;
    28. 'tailLog')
    29. tail -f $NGINX_DIR/logs/error.log
    30. ;;
    31. 'catLog')
    32. cat $NGINX_DIR/logs/error.log
    33. ;;
    34. *)
    35. echo "usage: `basename $0` {start | reload | stop | list | testconfig | version | tailLog | catLog}"
    36. esac