1
1
Fork 0
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-04-27 05:15:06 +02:00
docker-mailserver/target/bin/delquota
Georg Lauterbach c881facbd2
start-mailserver.sh split (#1820)
* splitting start-mailserver.sh

* refactoring part 2

* refactored setup-stack.sh
* stzarted adjusting target/bin/*.sh to use new usage format

* corrected lowercase-uppercase test error

* better handling of .bashrc variable export

* linting tests and fix for default assignements

* last stylistic changes and rebase
2021-02-23 20:03:01 +01:00

27 lines
700 B
Bash
Executable File

#! /bin/bash
# shellcheck source=../scripts/helper-functions.sh
. /usr/local/bin/helper-functions.sh
DATABASE=${DATABASE:-/tmp/docker-mailserver/dovecot-quotas.cf}
USER_DATABASE=${USER_DATABASE:-/tmp/docker-mailserver/postfix-accounts.cf}
function __usage { echo "Usage: delquota <username@domain>" ; }
[[ ${1:-} == 'help' ]] && { __usage ; exit 0 ; }
USER="${1}"
[[ -z ${USER} ]] && { __usage ; errex "No username specified" ; }
[[ "${USER}" =~ .*\@.* ]] || { __usage ; errex "Username must include the domain"; }
if ! grep -qE "^${USER}\|" "${USER_DATABASE}"
then
__usage
errex "user ${USER} does not exist"
fi
[[ -s ${DATABASE} ]] || exit 0
sed -i -e "/^${USER}:.*$/d" "${DATABASE}"