mirror of
https://github.com/lucascbeyeler/zmbackup.git
synced 2026-04-24 22:55:56 +03:00
[GH-ISSUE #36] mail filter backup #23
Labels
No labels
Bug Report
Enhancement
Enhancement
Feature Idea
Feature Idea
Not Implemented
Question
Question
Task
Wontfix
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/zmbackup#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @antonzhelyazkov on GitHub (May 2, 2017).
Original GitHub issue: https://github.com/lucascbeyeler/zmbackup/issues/36
Originally assigned to: @lucascbeyeler on GitHub.
Hi,
You could add users mail filter backup. I wrote simple script to do it
cat /backups/zmigrate/filters-export.sh
#!/bin/bash
set -x
clear
echo “Retrieve zimbra user name…”
USERS=
cat /backups/zmigrate/emails.txt;for ACCOUNT in $USERS; do
NAME=
echo $ACCOUNT;filter=
su – zimbra -c “zmprov ga $NAME zimbraMailSieveScript” > /tmp/$NAMEsed -i -e “1d” /tmp/$NAME
sed ‘s/zimbraMailSieveScript: //g’ /tmp/$NAME > /backups/zmigrate/filters/$NAME;
rm /tmp/$NAME
echo “Export filter for $NAME…”
done
echo “All filter has been export successfully”
And script for import filters:
#!/bin/bash
set -x
for file in /backups/zmigrate/filters/*
do
StrFilter=
cat “$file”Acc=$file
su – zimbra -c “zmprov ma $(echo $file | grep -E -o “\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,6}\b”) zimbraMailSieveScript ‘$StrFilter'”
echo “Process filter $Acc”
done
echo “All filter has been import successfully”
@lucascbeyeler commented on GitHub (May 14, 2017):
Good morning @antonzhelyazkov ,
I'm going to implement this in the next release of Zmbackup (1.2). About your code, can you provide the same solution, but with the ldapsearch command? Zmprov is a little slow to execute and I think it will affect the entire backup process...
Regards,
Lucas Costa Beyeler