From a6fbef98355da91530768cc63fa24c907b528a94 Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Tue, 8 Dec 2015 01:59:45 +0100 Subject: [PATCH 1/2] Do not create dir if it exists --- start-mailserver.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/start-mailserver.sh b/start-mailserver.sh index ce82eb33..8b9c89b5 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -25,7 +25,12 @@ if [ -f /tmp/postfix/accounts.cf ]; then echo "${pass}" | userdbpw -md5 | userdb ${login} set systempw echo "${pass}" | saslpasswd2 -p -c -u ${domain} ${login} mkdir -p /var/mail/${domain} - maildirmake /var/mail/${domain}/${user} + if [ -d "/var/mail/${domain}/${user}" ]; then + # Directory already present + echo "Directory present" + else + maildirmake "/var/mail/${domain}/${user}" + fi echo ${domain} >> /tmp/vhost.tmp done < /tmp/postfix/accounts.cf makeuserdb From a14f4879aafcd6ac24cf62b551d6ca1b42f114fb Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Sat, 16 Jan 2016 00:54:51 +0100 Subject: [PATCH 2/2] Remove redundant print --- start-mailserver.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/start-mailserver.sh b/start-mailserver.sh index 8b9c89b5..22ecdc53 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -25,10 +25,7 @@ if [ -f /tmp/postfix/accounts.cf ]; then echo "${pass}" | userdbpw -md5 | userdb ${login} set systempw echo "${pass}" | saslpasswd2 -p -c -u ${domain} ${login} mkdir -p /var/mail/${domain} - if [ -d "/var/mail/${domain}/${user}" ]; then - # Directory already present - echo "Directory present" - else + if [ ! -d "/var/mail/${domain}/${user}" ]; then maildirmake "/var/mail/${domain}/${user}" fi echo ${domain} >> /tmp/vhost.tmp