wait for dovecot

This commit is contained in:
Andreas Knuth 2026-01-27 21:21:43 -06:00
parent 1d5e24f541
commit 96a1815b6a
2 changed files with 19 additions and 5 deletions

View File

@ -1,12 +1,10 @@
[program:sieve-sync] [program:sieve-sync]
command=/usr/bin/python3 /scripts/sync.py # Das "-u" ist entscheidend für sofortige Logs!
# Wichtig: stdout_logfile schickt die Logs an den Docker Log Stream command=/usr/bin/python3 -u /scripts/sync.py
# Damit sehen Sie die Logs via "docker logs <container>"
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
autostart=true autostart=true
autorestart=true autorestart=true
startsecs=5 startsecs=5
# Hier werden die ENV Vars des Containers automatisch an das Script vererbt!

View File

@ -108,7 +108,23 @@ def sync():
print(f'{email}') print(f'{email}')
def wait_for_dovecot():
"""Wartet, bis der Dovecot Auth Socket verfügbar ist."""
# Der Pfad zum Socket, über den doveadm kommuniziert
socket_path = '/var/run/dovecot/auth-userdb'
print("⏳ Warte auf Dovecot Start...")
while not os.path.exists(socket_path):
print(f" ... Socket {socket_path} noch nicht da. Schlafe 5s.")
time.sleep(5)
print("✅ Dovecot ist bereit!")
if __name__ == '__main__': if __name__ == '__main__':
# 1. Erst warten, bis Dovecot da ist, sonst hagelt es Fehler beim Start
wait_for_dovecot()
# Pfad zur Cron-Definition (nur der String, z.B. "*/5 * * * *") # Pfad zur Cron-Definition (nur der String, z.B. "*/5 * * * *")
CRON_FILE = '/etc/sieve-schedule' CRON_FILE = '/etc/sieve-schedule'