Created
January 17, 2018 14:55
-
-
Save tpokorra/4e34c09b6f1d1c641cd8a1d33779f85c to your computer and use it in GitHub Desktop.
only use this as a reference, don't run it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "$0 <user> <domain> <folder>" | |
echo "for example: $0"' "my.user" mydomain.com "Anfragen"' | |
echo "for a deleted mailbox: $0"' "test.test" test.tbits.net "test" "test" 1' | |
exit | |
fi | |
user=$1 | |
domain=$2 | |
folder=$3 | |
foldermitUmlaut=$4 | |
if [ -z $4 ] | |
then | |
foldermitUmlaut=$3 | |
fi | |
deleted=$5 | |
fdomain=${domain:0:1} | |
fuser=${user:0:1} | |
muser=${user/./^} | |
if [ ! -z "$folder" ] | |
then | |
folder="/"$folder | |
foldermitUmlaut="/"$foldermitUmlaut | |
fi | |
if [ -z $deleted ] | |
then | |
path="/var/spool/imap/domain/$fdomain/$domain/$fuser/user/$muser$folder" | |
mbox="user/$user$folder@$domain" | |
mboxmitUmlaut="user/$user$foldermitUmlaut@$domain" | |
else | |
path="/var/spool/imap/domain/$fdomain/$domain/u/DELETED/user/$muser$folder" | |
mbox="DELETED/user/$user$folder@$domain" | |
mboxmitUmlaut="DELETED/user/$user$foldermitUmlaut@$domain" | |
fi | |
echo $path | |
if [ -d "$path" ] | |
then | |
echo "that folder exists!" | |
echo kolab set-mailbox-acl \"$mboxmitUmlaut\" cyrus-admin c | |
echo kolab dm \"$mboxmitUmlaut\" | |
exit | |
fi | |
/usr/lib/cyrus-imapd/reconstruct -r -f "$mbox" | |
if [ -d "$path" ] | |
then | |
kolab set-mailbox-acl "$mboxmitUmlaut" cyrus-admin c | |
kolab dm "$mboxmitUmlaut@$domain" | |
fi | |
/usr/lib/cyrus-imapd/quota -f -d $domain | |
tail -n 100 /var/log/maillog | grep $domain | |
#tail -f /var/log/maillog | grep "$user" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment