| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/usr/bin/env bash
- #description: Startup and shutdown script for nginx
- #define nginx diri
- CURRENT_DIR=$(cd "$(dirname "$0")"; pwd)
- NGINX_INSTALL="/usr/local/nginx"
- NGINX="$NGINX_INSTALL/sbin/nginx"
- NGINX_CONFIG="$NGINX_INSTALL/conf/nginx.conf"
- NGINX_PID="$NGINX_INSTALL/nginx.pid"
- case $1 in
- 'start' )
- if test -x $NGINX
- then
- echo "Starting Nginx.. config: $NGINX_CONFIG"
- if $NGINX -c $NGINX_CONFIG
- then
- echo "OK"
- else
- echo "failed"
- fi
- else
- echo "Couldn't find Nginx($NGINX)"
- fi
- ;;
- 'stop' )
- echo "Stopping Nginx..."
- if $NGINX -s stop
- then
- echo "OK"
- else
- echo "failed"
- fi
- ;;
- 'restart'|'reload' )
- if $NGINX -s reload
- then
- echo "OK"
- else
- echo "failed"
- fi
- ;;
- 'list' )
- ps aux | egrep '(PID|nginx)'
- ;;
- *)
- echo "usage: `basename $0` {start|restart|reload|stop|list}"
- esac
|