docker-mailserver/target/bin/listmailuser

19 lines
376 B
Plaintext
Raw Normal View History

#! /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"
2019-08-01 17:39:25 +00:00
# Lock database even though we are only reading
(
flock -e 200
awk -F '|' '{ print $1; }' $DATABASE
) 200<$DATABASE