From 1da550b499726bf078a8dfb9adf2b3138442dc91 Mon Sep 17 00:00:00 2001 From: andryyy Date: Thu, 12 Jan 2017 20:16:01 +0100 Subject: [PATCH] Check Postfix config before spawning Postfix procs --- data/Dockerfiles/postfix/postfix.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index 7aefd612..3dd108d0 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -6,6 +6,11 @@ sed -i "/^user/c\user = ${DBUSER}" /opt/postfix/conf/sql/* sed -i "/^password/c\password = ${DBPASS}" /opt/postfix/conf/sql/* sed -i "/^dbname/c\dbname = ${DBNAME}" /opt/postfix/conf/sql/* -postfix -c /opt/postfix/conf start - -sleep infinity +postconf -c /opt/postfix/conf +if [[ $? != 0 ]]; then + echo "Postfix configuration error, refusing to start." + exit 1 +else + postfix -c /opt/postfix/conf start + sleep infinity +fi