package/nginx/S50nginx: Do not assume start-stop-daemon knows -R.
authorThomas Claveirole <thomas.claveirole@green-communications.fr>
Mon, 9 Oct 2017 09:50:49 +0000 (11:50 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Tue, 10 Oct 2017 15:51:02 +0000 (17:51 +0200)
start-stop-daemon fails on -R when not compiled with
CONFIG_FEATURE_START_STOP_DAEMON_FANCY.  Thus, do not rely on -R
during stop to avoid a race condition during restart.

Use a sleep 1 during restart instead, as suggested by Peter Korsgaard
in <87bmluk4bm.fsf@dell.be.48ers.dk>.

Signed-off-by: Thomas Claveirole <thomas.claveirole@green-communications.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/nginx/S50nginx

index a854c651d1a0d83cc3236c4dea25da88c6f3ca32..964652b9224db8a9573abbbe98ee6e7a0ab0ab52 100755 (executable)
@@ -14,10 +14,7 @@ case "$1" in
        ;;
   stop)
        echo "Stopping nginx..."
-       # Use -R 1 to wait for nginx to actually stop.  Useful so
-       # restart has no race condition.  Note that BusyBox knows
-       # about -R but ignores it silently.
-       start-stop-daemon -K -x "$NGINX" -p "$PIDFILE" -R 1 -o
+       start-stop-daemon -K -x "$NGINX" -p "$PIDFILE" -o
        ;;
   reload|force-reload)
        echo "Reloading nginx configuration..."
@@ -25,6 +22,7 @@ case "$1" in
        ;;
   restart)
        "$0" stop
+       sleep 1 # Prevent race condition: ensure nginx stops before start.
        "$0" start
        ;;
   *)