added backupmx script

This commit is contained in:
Oliver Ladner 2011-03-17 14:01:36 +01:00
commit 50a243d155
2 changed files with 22 additions and 0 deletions

22
backupmx_getusers.sh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# Fetches all users and aliases from MySQL
# For import in other backup MX config.
#
# Requires a .my.cnf with this content:
# [client]
# password=foo
BACKUPMX_USER=/home/backupmx
MAIL_ADDR=$(mysql -sN -u root mailserver -e "SELECT email from virtual_users UNION SELECT source FROM virtual_aliases;" | sort | uniq)
# Makes a list of all mail addresses (be it real or aliases)
for i in $MAIL_ADDR; do
echo -e "$i\tOK"
done > $BACKUPMX_USER/relay_recipients_$(cat /etc/mailname)
# Generates list of all domains
for i in $MAIL_ADDR; do
echo $i | cut -d'@' -f2
done | sort | uniq > $BACKUPMX_USER/domains_$(cat /etc/mailname)

0
rblcheck.sh Normal file → Executable file
View file