45 lines
1.3 KiB
Bash
45 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
[ "${DEBUG}" == "yes" ] && set -x
|
|
|
|
function add_config_value() {
|
|
local key=${1}
|
|
local value=${2}
|
|
# local config_file=${3:-/etc/postfix/main.cf}
|
|
[ "${key}" == "" ] && echo "ERROR: No key set !!" && exit 1
|
|
[ "${value}" == "" ] && echo "ERROR: No value set !!" && exit 1
|
|
|
|
echo "Setting configuration option ${key} with value: ${value}"
|
|
postconf -e "${key} = ${value}"
|
|
}
|
|
|
|
#Copy files into config dir
|
|
|
|
#Move missing files from Postfix to /config
|
|
mv -n /etc/postfix/main.cf /config/main.cf
|
|
mv -n /etc/postfix/master.cf /config/master.cf
|
|
mv -n /etc/postfix/pgsql-relay-domains.cf /config/pgsql-relay-domains.cf
|
|
mv -n /etc/postfix/pgsql-transport-maps.cf /config/pgsql-transport-maps.cf
|
|
|
|
#Delete files from Postfix
|
|
rm /etc/postfix/main.cf
|
|
rm /etc/postfix/master.cf
|
|
rm /etc/postfix/pgsql-relay-domains.cf
|
|
rm /etc/postfix/pgsql-transport-maps.cf
|
|
|
|
#Link files into Postfix
|
|
ln -s /config/main.cf /etc/postfix/main.cf
|
|
ln -s /config/pgsql-relay-domains.cf /etc/postfix/pgsql-relay-domains.cf
|
|
ln -s /config/pgsql-transport-maps.cf /etc/postfix/pgsql-transport-maps.cf
|
|
ln -s /config/master.cf /etc/postfix/master.cf
|
|
|
|
#Open permissions
|
|
chmod -R 777 /config
|
|
|
|
#Start services
|
|
|
|
# If host mounting /var/spool/postfix, we need to delete old pid file before
|
|
# starting services
|
|
rm -f /var/spool/postfix/pid/master.pid
|
|
|
|
exec /usr/sbin/postfix -c /etc/postfix start-fg |