From 449af8eb0ba31b8f79427a8a0d694913e9abd20d Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sun, 3 Dec 2017 11:28:26 +0100 Subject: [PATCH] Make sure stale pid files are dealt with, fix #341 (cherry picked from commit 4761646616ddd6718ae0889149f68583278ab2ab) --- core/nginx/config.py | 3 ++- core/nginx/start.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/nginx/config.py b/core/nginx/config.py index 55fd2f9..81f1010 100755 --- a/core/nginx/config.py +++ b/core/nginx/config.py @@ -31,4 +31,5 @@ if args["TLS"] and not all(os.path.exists(file_path) for file_path in args["TLS" convert("/conf/tls.conf", "/etc/nginx/tls.conf", args) convert("/conf/proxy.conf", "/etc/nginx/proxy.conf", args) convert("/conf/nginx.conf", "/etc/nginx/nginx.conf", args) -os.system("nginx -s reload") +if os.path.exists("/var/log/nginx.pid"): + os.system("nginx -s reload") diff --git a/core/nginx/start.py b/core/nginx/start.py index daf05e1..f225b5f 100755 --- a/core/nginx/start.py +++ b/core/nginx/start.py @@ -3,6 +3,9 @@ import os import subprocess +# Check if a stale pid file exists +if os.path.exists("/var/log/nginx.pid"): + os.remove("/var/log/nginx.pid") # Actual startup script if not os.path.exists("/certs/dhparam.pem") and os.environ["TLS_FLAVOR"] != "notls":