mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
20 lines
469 B
Bash
Executable file
20 lines
469 B
Bash
Executable file
#! /bin/bash
|
|
|
|
# shellcheck source=../scripts/helpers/index.sh
|
|
source /usr/local/bin/helpers/index.sh
|
|
|
|
DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-relaymap.cf}
|
|
|
|
DOMAIN="${1}"
|
|
|
|
function usage { echo "Usage: excluderelayhost <domain>" ; }
|
|
|
|
[[ -z ${DOMAIN} ]] && { usage ; _errex "no domain specified" ; }
|
|
|
|
if grep -qi "^@${DOMAIN}" "${DATABASE}" 2>/dev/null
|
|
then
|
|
sed -i "s/^@${DOMAIN}.*/@${DOMAIN}/" "${DATABASE}"
|
|
else
|
|
echo -e "@${DOMAIN}" >> "${DATABASE}"
|
|
fi
|