smtp/init
2018-01-31 22:56:02 +11:00

27 lines
487 B
Bash
Executable File

#!/bin/bash
set -e
NAME="SMTP"
function stop {
echo "Stopping ${NAME}"
kill $(cat /run/saslauthd/saslauthd.pid)
kill $(cat /run/sendmail/mta/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 && make && make && exec /usr/sbin/sendmail -q1h -bD &
wait
else
exec $@
fi