# 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