2023-04-25 10:39:41 +00:00
|
|
|
#!/bin/sh
|
2017-07-23 07:56:38 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
NAME="SMTP"
|
|
|
|
|
|
|
|
function stop {
|
|
|
|
echo "Stopping ${NAME}"
|
2018-01-31 11:56:02 +00:00
|
|
|
kill $(cat /run/saslauthd/saslauthd.pid)
|
|
|
|
kill $(cat /run/sendmail/mta/sendmail.pid|head -1)
|
2017-07-23 07:56:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trap 'stop' SIGTERM
|
|
|
|
|
2023-04-25 10:39:41 +00:00
|
|
|
if [ -z "$@" ]; then
|
|
|
|
if [ -z `hostname -d` ]; then
|
|
|
|
echo "You must start this container with --hostname= specifying a domain name"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-07-23 07:56:38 +00:00
|
|
|
|
2023-04-28 05:16:31 +00:00
|
|
|
touch /etc/postfix/custom/relay_host
|
|
|
|
touch /etc/postfix/custom/sasl_passwd
|
|
|
|
postmap -o lmdb:/etc/postfix/custom/sasl_passwd
|
|
|
|
touch /etc/postfix/custom/transport
|
|
|
|
postmap -o lmdb:/etc/postfix/custom/transport
|
|
|
|
/usr/sbin/saslauthd -m /run/saslauthd -ca shadow
|
2023-04-25 10:39:41 +00:00
|
|
|
newaliases
|
|
|
|
postfix start
|
|
|
|
/usr/sbin/opendkim -P /run/opendkim.pid -u opendkim -f
|
2017-07-23 07:56:38 +00:00
|
|
|
|
|
|
|
wait
|
|
|
|
else
|
|
|
|
exec $@
|
|
|
|
fi
|