From 9a2114ccbf5d4903c6529fd958d0d30bbac3f022 Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Sat, 16 Feb 2019 12:33:15 +0100
Subject: [PATCH] Use PID to kill gunicorn

---
 Makefile.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 749fa17..1d5bdf3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -37,7 +37,7 @@ start:
 	@echo Starting the web server on 0.0.0.0:${WEBSERVER_PORT}
 	@#
 	@tmux send-keys -t ${SESSION_NAME}:main.3  \
-	    "gunicorn -w 4 -b 0.0.0.0:${WEBSERVER_PORT} km3mon:app" Enter
+	    "gunicorn --pid gunicorn.pid -w 4 -b 0.0.0.0:${WEBSERVER_PORT} km3mon:app" Enter
 	@tmux select-layout even-vertical
 
 	@echo Starting the monitoring scripts
@@ -100,8 +100,10 @@ start:
 	@tmux select-layout even-vertical
 
 stop:
+	@echo Stopping monitoring session...
 	tmux kill-session -t ${SESSION_NAME}
-	killall gunicorn
+	kill -9 $(shell cat gunicorn.pid)
+	@sleep 5
 
 clean:
 	rm Makefile
-- 
GitLab