smtp/init

26 lines
469 B
Plaintext
Raw Normal View History

2017-07-23 07:56:38 +00:00
#!/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