From 118959fab1463300c01fac8211c3cfb33049fbed Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 6 Jun 2017 01:22:51 +0200 Subject: [PATCH] Add script get_mail_domains.sh --- get_mail_domains.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 get_mail_domains.sh diff --git a/get_mail_domains.sh b/get_mail_domains.sh new file mode 100755 index 0000000..2bf5fa5 --- /dev/null +++ b/get_mail_domains.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +mysql=false +mysql_credentilas="--login-path=local" +mysql_db=postfix + +echo "" +if $mysql ; then + domains=$(mysql $mysql_credentilas $mysql_db -N -s -e "SELECT domain FROM domain ORDER by domain") +else + domains=$(su - postgres -c"psql postfix -t -q -c\"SELECT domain FROM domain ORDER by domain\"") +fi +echo -e "$domains" +echo "" + + + +exit 0