Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
only use this as a reference, don't run it
#!/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
You can’t perform that action at this time.