1
0
Fork 0

Refresh haproxy after letsencrypt

This commit is contained in:
Joao M 2022-09-02 21:22:17 +00:00
parent f8046670a9
commit 3a3d5204a3
2 changed files with 16 additions and 4 deletions

View file

@ -4,6 +4,8 @@ import subprocess
import shlex
import time
import os
import re
import time
class Functions:
HAPROXY_LOG="HAPROXY"
@ -105,6 +107,7 @@ class DaemonizeHAProxy:
def __init__(self):
self.process = None
self.thread = None
self.sleep_secs = None
def haproxy(self, action):
if action == "start":
@ -160,6 +163,15 @@ class DaemonizeHAProxy:
self.process.terminate()
self.thread.terminate()
def sleep(self):
if self.sleep_secs is None:
try:
self.sleep_secs = int(os.getenv("EASYHAPROXY_REFRESH_CONF", "10"))
except ValueError:
self.sleep_secs = 10
time.sleep(self.sleep_secs)
class Certbot:
def __init__(self, certs, email):