xref: /OK3568_Linux_fs/buildroot/package/nginx/S50nginx (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
3# Start/stop nginx
4#
5
6NGINX=/usr/sbin/nginx
7PIDFILE=/var/run/nginx.pid
8
9case "$1" in
10  start)
11	echo "Starting nginx..."
12	mkdir -p /var/log/nginx /var/cache/nginx
13	start-stop-daemon -S -x "$NGINX" -p "$PIDFILE"
14	;;
15  stop)
16	echo "Stopping nginx..."
17	start-stop-daemon -K -x "$NGINX" -p "$PIDFILE" -o
18	;;
19  reload|force-reload)
20	echo "Reloading nginx configuration..."
21	"$NGINX" -s reload
22	;;
23  restart)
24	"$0" stop
25	sleep 1 # Prevent race condition: ensure nginx stops before start.
26	"$0" start
27	;;
28  *)
29	echo "Usage: $0 {start|stop|restart|reload|force-reload}"
30	exit 1
31esac
32