We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8f4e42 commit 07b5ba9Copy full SHA for 07b5ba9
0x1A-application_server/4-reload_gunicorn_no_downtime
@@ -1,4 +1,21 @@
1
-#!/usr/bin/env bash
2
-# Gracefully reloads Gunicorn.
+#!/bin/bash
3
4
-pgrep gunicorn | awk '{ print $2 }' | xargs kill -HUP
+# Find the Gunicorn master process ID
+GUNICORN_PID=$(pgrep -f 'gunicorn --bind')
5
+
6
+# Check if the PID was found
7
+if [ -z "$GUNICORN_PID" ]; then
8
+ echo "Gunicorn master process not found."
9
+ exit 1
10
+fi
11
12
+# Send the SIGHUP signal to the Gunicorn master process
13
+kill -HUP "$GUNICORN_PID"
14
15
+# Check if the signal was sent successfully
16
+if [ $? -eq 0 ]; then
17
+ echo "Gunicorn master process reloaded successfully."
18
+else
19
+ echo "Failed to reload Gunicorn master process."
20
21
0 commit comments