From 96a1815b6af33056aad1649b175833fad4c907d8 Mon Sep 17 00:00:00 2001 From: Andreas Knuth Date: Tue, 27 Jan 2026 21:21:43 -0600 Subject: [PATCH] wait for dovecot --- DMS/sieve-supervisor.conf | 8 +++----- DMS/sync_dynamodb_to_sieve.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/DMS/sieve-supervisor.conf b/DMS/sieve-supervisor.conf index cf81c82..fa1a888 100644 --- a/DMS/sieve-supervisor.conf +++ b/DMS/sieve-supervisor.conf @@ -1,12 +1,10 @@ [program:sieve-sync] -command=/usr/bin/python3 /scripts/sync.py -# Wichtig: stdout_logfile schickt die Logs an den Docker Log Stream -# Damit sehen Sie die Logs via "docker logs " +# Das "-u" ist entscheidend für sofortige Logs! +command=/usr/bin/python3 -u /scripts/sync.py stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 autostart=true autorestart=true -startsecs=5 -# Hier werden die ENV Vars des Containers automatisch an das Script vererbt! \ No newline at end of file +startsecs=5 \ No newline at end of file diff --git a/DMS/sync_dynamodb_to_sieve.py b/DMS/sync_dynamodb_to_sieve.py index 6330db3..6fec6f6 100644 --- a/DMS/sync_dynamodb_to_sieve.py +++ b/DMS/sync_dynamodb_to_sieve.py @@ -108,7 +108,23 @@ def sync(): 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__': + + # 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 * * * *") CRON_FILE = '/etc/sieve-schedule'