summaryrefslogtreecommitdiff
path: root/playbooks/roles/mail/templates/volumes/scripts/wait-for-postfix.unused.sh
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/roles/mail/templates/volumes/scripts/wait-for-postfix.unused.sh')
-rw-r--r--playbooks/roles/mail/templates/volumes/scripts/wait-for-postfix.unused.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/playbooks/roles/mail/templates/volumes/scripts/wait-for-postfix.unused.sh b/playbooks/roles/mail/templates/volumes/scripts/wait-for-postfix.unused.sh
new file mode 100644
index 0000000..3e8a8c5
--- /dev/null
+++ b/playbooks/roles/mail/templates/volumes/scripts/wait-for-postfix.unused.sh
@@ -0,0 +1,27 @@
+# This was an attempt to keep rolling updates with very little downtime.
+# I don't think it's worth it, and the nature of update_config provides
+# little flexibility to use here.
+
+#!/bin/bash
+set -e
+
+function log() {
+ echo "[startup] $@"
+}
+
+LOCKFILE="/var/mail-state/lib-postfix/master.lock"
+MAX_TRIES=30
+TRY=0
+
+while [ -f "$LOCKFILE" ]; do
+ if [ "$TRY" -eq "$MAX_TRIES" ]; then
+ log "[$TRY/$MAX_TRIES] Max tries, failing."
+ exit 1
+ fi
+ log "[$TRY/$MAX_TRIES] Lockfile exists, waiting for it to be cleaned up by previous container..."
+ sleep 2
+ TRY=$((TRY + 1))
+done
+
+log "Lock check done. Starting DMS."
+supervisord -c /etc/supervisor/supervisord.conf