Make sure stale pid files are dealt with, fix #341

This commit is contained in:
kaiyou
2017-12-03 11:28:26 +01:00
parent 743eb81908
commit 4761646616
2 changed files with 5 additions and 1 deletions

View File

@@ -30,4 +30,5 @@ if args["TLS"] and not all(os.path.exists(file_path) for file_path in args["TLS"
# Build final configuration paths # Build final configuration paths
convert("/conf/tls.conf", "/etc/nginx/tls.conf", args) convert("/conf/tls.conf", "/etc/nginx/tls.conf", args)
convert("/conf/nginx.conf", "/etc/nginx/nginx.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")

View File

@@ -3,6 +3,9 @@
import os import os
import subprocess 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 # Actual startup script
if not os.path.exists("/certs/dhparam.pem") and os.environ["TLS_FLAVOR"] != "notls": if not os.path.exists("/certs/dhparam.pem") and os.environ["TLS_FLAVOR"] != "notls":