vmail-stack/bin/vmail-dovecot-disable.sh

36 lines
874 B
Bash
Raw Normal View History

#!/bin/bash
#
# vmail-stack
# https://git.stack-source.com/msb/vmail-stack
# Copyright (c) 2023 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# load include file
source $(dirname $0)/vmail.sh
help()
{
thisfilename=$(basename -- "$0")
echo "$thisfilename"
echo "Disable dovecot for given domain"
echo ""
echo "usage: $thisfilename -d <domain> [-h]"
echo ""
echo " -h Print this help."
echo " -d <domain> Domain to disable dovecot for."
}
vmail:getoptions "$@"
# check for domain
if [[ -z $domain ]]; then
echo "ERROR: domain name is required"
exit 1
fi
# disable dovecot for domain
if [ -f "/etc/dovecot/sites.d/mail.$domain.conf" ]; then
rm /etc/dovecot/sites.d/mail.$domain.conf
systemctl --quiet try-reload-or-restart dovecot
fi