smtp/init
2017-07-23 17:56:38 +10:00

26 lines
469 B
Bash
Executable File

#!/bin/bash
set -e
NAME="SMTP"
function stop {
echo "Stopping ${NAME}"
kill $(cat /var/run/sendmail.pid|head -1)
}
trap 'stop' SIGTERM
if [ -z `hostname --domain` ]; then
echo "You must start this container with --hostname= specifying a domain name"
exit 1
fi
if [ "$1" == "start" ]; then
/usr/sbin/saslauthd -m /run/saslauthd -a pam
cd /etc/mail && rm -f *.db && make && m4 sendmail.mc > sendmail.cf && /usr/sbin/sendmail -q1h -bD &
wait
else
exec $@
fi