2022-10-08 15:55:40 +02:00
|
|
|
#!/usr/bin/env python3
|
2017-09-24 14:01:03 +02:00
|
|
|
|
|
|
|
import os
|
2017-09-24 17:50:10 +02:00
|
|
|
import subprocess
|
2023-04-12 21:22:44 +02:00
|
|
|
from socrate import system
|
|
|
|
|
2023-04-21 08:59:42 +02:00
|
|
|
system.set_env(log_filters=[
|
|
|
|
r'could not be resolved \(\d\: [^\)]+\) while in resolving client address, client\: [^,]+, server: [^\:]+\:(25,110,143,587,465,993,995)$',
|
|
|
|
r'waitpid\(\) returned unknown PID \d+$',
|
|
|
|
])
|
2017-09-24 17:50:10 +02:00
|
|
|
|
2017-12-03 11:28:26 +01:00
|
|
|
# Check if a stale pid file exists
|
2018-06-02 10:23:33 +02:00
|
|
|
if os.path.exists("/var/run/nginx.pid"):
|
|
|
|
os.remove("/var/run/nginx.pid")
|
2017-09-24 14:01:03 +02:00
|
|
|
|
2017-12-05 00:21:58 +01:00
|
|
|
if os.environ["TLS_FLAVOR"] in [ "letsencrypt","mail-letsencrypt" ]:
|
2017-09-24 17:50:10 +02:00
|
|
|
subprocess.Popen(["/letsencrypt.py"])
|
2018-12-06 16:48:26 +01:00
|
|
|
elif os.environ["TLS_FLAVOR"] in [ "mail", "cert" ]:
|
|
|
|
subprocess.Popen(["/certwatcher.py"])
|
2017-09-24 17:50:10 +02:00
|
|
|
|
|
|
|
subprocess.call(["/config.py"])
|
2023-04-20 15:36:17 +02:00
|
|
|
os.system("dovecot -c /etc/dovecot/proxy.conf")
|
2017-09-24 14:01:03 +02:00
|
|
|
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
|