1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-14 10:53:30 +02:00
Mailu/postfix/start.sh

46 lines
1.3 KiB
Bash
Raw Normal View History

2016-03-02 22:25:56 +02:00
#!/bin/bash
2016-03-02 22:25:56 +02:00
# Substitute configuration
for VARIABLE in `env | cut -f1 -d=`; do
sed -i "s={{ $VARIABLE }}=${!VARIABLE}=g" /etc/postfix/*.cf
2016-03-02 22:25:56 +02:00
done
# Override Postfix main configuration
if [ -f /overrides/postfix.cf ]; then
2016-08-01 10:29:15 +02:00
while read line; do
postconf -e "$line"
done < /overrides/postfix.cf
echo "Loaded '/overrides/postfix.cf'"
2016-08-01 10:29:15 +02:00
else
echo "No extra postfix settings loaded because optional '/overrides/postfix.cf' not provided."
2016-08-01 10:29:15 +02:00
fi
# Override Postfix master configuration
if [ -f /overrides/postfix.master ]; then
while read line; do
postconf -Me "$line"
done < /overrides/postfix.master
echo "Loaded '/overrides/postfix.master'"
else
echo "No extra postfix settings loaded because optional '/overrides/postfix.master' not provided."
fi
2016-08-01 10:29:15 +02:00
# Include table-map files
if ls -A /overrides/*.map 1> /dev/null 2>&1; then
cp /overrides/*.map /etc/postfix/
2016-08-01 10:29:15 +02:00
postmap /etc/postfix/*.map
rm /etc/postfix/*.map
chown root:root /etc/postfix/*.db
chmod 0600 /etc/postfix/*.db
2016-08-01 11:17:57 +02:00
echo "Loaded 'map files'"
else
echo "No extra map files loaded because optional '/overrides/*.map' not provided."
2016-08-01 10:29:15 +02:00
fi
2016-03-02 22:25:56 +02:00
# Actually run Postfix
2016-03-20 16:37:15 +02:00
rm -f /var/run/rsyslogd.pid
chown -R postfix: /queue
/usr/lib/postfix/post-install meta_directory=/etc/postfix create-missing
/usr/lib/postfix/master &
2017-07-19 07:21:14 +02:00
exec rsyslogd -n