1
0
containers/postfix/start.sh
2024-12-19 22:32:42 -05:00

34 lines
994 B
Bash
Executable File

#!/bin/sh
# --- 2023 Old ---
# # Add ENV vars to postfix config
# # postconf -e -c /config myhostname=$HOSTNAME
# /usr/sbin/postconf compatibility_level=3.6
# # Upgrade postfix config
# postfix -c /config upgrade-configuration
# # Config check
# postfix -c /config check
# # Start postfix
# /usr/sbin/postfix -vvvv -c /config start-fg
# --- 2024-12-18 ---
PUBLIC_IP=$(curl https://ipv4.icanhazip.com)
echo "Public IP: $PUBLIC_IP"
echo "Hostname: $POSTFIX_HOST"
echo "Domain: $POSTFIX_DOMAIN"
echo "Templating files..."
eval "echo \"$(cat /templates/ldap_aliases.cf.tmpl)\"" > /config/ldap_aliases.cf
eval "echo \"$(cat /templates/ldap_senders.cf.tmpl)\"" > /config/ldap_senders.cf
eval "echo \"$(cat /templates/main.cf.tmpl)\"" > /config/main.cf
echo "Copying resolv.conf into /var/spool/postfix"
mkdir -p /var/spool/postfix/etc
chmod o+rx /var/spool/postfix/etc
cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf
echo "Starting Postfix..."
/usr/sbin/postfix -v -c /config start-fg