mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
19 lines
414 B
Bash
Executable file
19 lines
414 B
Bash
Executable file
#! /bin/bash
|
|
|
|
DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-accounts.cf}
|
|
|
|
errex() {
|
|
echo "$@" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
[ -f $DATABASE ] || errex "No postfix-accounts.cf file"
|
|
[ -s $DATABASE ] || errex "Empty postfix-accounts.cf - no users have been added"
|
|
|
|
# Lock database even though we are only reading
|
|
(
|
|
flock -e 200
|
|
(grep -v "^\s*$\|^\s*\#" "$DATABASE" || true) | awk -F '|' '{ print $1; }'
|
|
) 200<$DATABASE
|
|
|