Corrected many things after actual deployment

This commit is contained in:
oscarg
2026-08-11 04:16:33 +00:00
parent d53e7eef37
commit 28143427ff
4 changed files with 42 additions and 11 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
if [ ! -d /caddy-data ] || [ ! -d /stalwart-certs ]; then
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] FATAL: Required volume mounts (/caddy-data or /stalwart-certs) are missing!" >&2
exit 1
fi
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] Certificate sync container initialized. Checking every 12 hours..."
while true; do
if [ -d /caddy-data/caddy/certificates ] && [ "$(ls -A /caddy-data/caddy/certificates 2>/dev/null)" ]; then
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] Syncing Caddy certificates to Stalwart..."
cp -a /caddy-data/caddy/certificates/. /stalwart-certs/
chown -R 2000:2000 /stalwart-certs
chmod -R 755 /stalwart-certs
find /stalwart-certs -type f -name '*.key' -exec chmod 600 {} +
find /stalwart-certs -type f -name '*.crt' -exec chmod 644 {} +
else
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] Waiting for certificates in /caddy-data/caddy/certificates..."
fi
sleep 43200 &
wait $!
done