Skip to content

Commit

Permalink
Cleanup fixes to bin/stop_gunicorn.sh (#3089)
Browse files Browse the repository at this point in the history
  • Loading branch information
willkg authored Dec 9, 2024
1 parent 33593b6 commit d656fe0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bin/stop_gunicorn.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/bin/bash

# Send the TERM signal to gunicorn to trigger a graceful shutdown, and wait for it to exit.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Send the TERM signal to gunicorn to trigger a graceful shutdown, and wait for
# it to exit.

set -euo pipefail

pid=`cat /tmp/gunicorn.pid`
pid=$(cat /tmp/gunicorn.pid)

if [ -n "$pid" ]; then
echo "Sending TERM signal to gunicorn."
kill -TERM "$pid"
echo "Waiting for gunicorn to exit..."
while kill -0 $pid 2>/dev/null; do
while kill -0 "$pid" 2>/dev/null; do
sleep 1
done
fi

0 comments on commit d656fe0

Please sign in to comment.