added backupmx script
This commit is contained in:
parent
0367d0582c
commit
50a243d155
2 changed files with 22 additions and 0 deletions
22
backupmx_getusers.sh
Executable file
22
backupmx_getusers.sh
Executable 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
0
rblcheck.sh
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue