fix database/table specification on mysqldump commands

This commit is contained in:
Matthew Saunders Brown 2023-10-06 13:40:50 -07:00
parent 4e15cb4199
commit 5bfce22f55

View File

@ -56,11 +56,11 @@ if [[ "$domains_id" -gt '0' ]] ; then
vmDbTableArray=("vm_domains" "vm_mboxes" "vm_aliases" "vm_autoresponders" "vm_filters" "vm_forwards")
# dump data from each table
for vmDbTable in ${vmDbTableArray[@]}; do
eval mysqldump --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE --no-create-info --extended-insert=FALSE --complete-insert --compact --databases vmail --tables $vmDbTable --where="\"domain='$domain'"\"|sed -e "s/(\`id\`,/(/"|sed -e "s/([0-9]*,/(/" >> /var/vmail/$domain/.exp/vm_dmp.sql
eval mysqldump --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE --no-create-info --extended-insert=FALSE --complete-insert --compact vmail $vmDbTable --where="\"domain='$domain'"\"|sed -e "s/(\`id\`,/(/"|sed -e "s/([0-9]*,/(/" >> /var/vmail/$domain/.exp/vm_dmp.sql
done
# handle special cases vm_greylisting & sa_userpref
eval mysqldump --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE --no-create-info --extended-insert=FALSE --complete-insert --compact --databases vmail --tables vm_greylisting --where="\"recipient LIKE '%@$domain'"\"|sed -e "s/(\`id\`,/(/"|sed -e "s/([0-9]*,/(/" >> /var/vmail/$domain/.exp/vm_dmp.sql
eval mysqldump --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE --no-create-info --extended-insert=FALSE --complete-insert --compact --databases vmail --tables sa_userpref --where="\"username LIKE '%@$domain'"\"|sed -e "s/, \`prefid\`)/)/"|sed -e "s/,[0-9]*);/);/" >> /var/vmail/$domain/.exp/vm_dmp.sql
eval mysqldump --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE --no-create-info --extended-insert=FALSE --complete-insert --compact vmail vm_greylisting --where="\"recipient LIKE '%@$domain'"\"|sed -e "s/(\`id\`,/(/"|sed -e "s/([0-9]*,/(/" >> /var/vmail/$domain/.exp/vm_dmp.sql
eval mysqldump --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE --no-create-info --extended-insert=FALSE --complete-insert --compact vmail sa_userpref --where="\"username LIKE '%@$domain'"\"|sed -e "s/, \`prefid\`)/)/"|sed -e "s/,[0-9]*);/);/" >> /var/vmail/$domain/.exp/vm_dmp.sql
# apache webmail config
if [[ -f /etc/apache2/sites-available/mail.$domain.conf ]]; then