initial commit of file from CVS for smeserver-dirty-tools on Sat Sep 7 20:17:20 AEST 2024
This commit is contained in:
23
root/sbin/e-smith/dt-dovecot-indexfiles-delete
Executable file
23
root/sbin/e-smith/dt-dovecot-indexfiles-delete
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# (C) 2008 Michael Weinberger
|
||||
# See http://wiki.contribs.org/Dirty_Tools for full documentation
|
||||
|
||||
# Sometimes Dovecot index files are corrupted after a restore
|
||||
# It is save to delete them all. Dovecot will rebuild them when the mailbox is accessed.
|
||||
|
||||
echo "Deleting Dovecot's index files";
|
||||
|
||||
# Find users - also finds /home/e-smith/files/users
|
||||
USERS=`/usr/bin/find /home/e-smith/files/users -maxdepth 1 -type d`
|
||||
|
||||
# Add Admin dir
|
||||
USERS="/home/e-smith/ $USERS" # admin
|
||||
|
||||
for u in $USERS; do
|
||||
# Ignore dirs without Maildir
|
||||
! /usr/bin/test -d $u/Maildir && continue
|
||||
/usr/bin/find $u/Maildir -maxdepth 2 -type f -name "dovecot.index*" -exec /bin/rm -f '{}' \;
|
||||
/usr/bin/find $u/Maildir -maxdepth 2 -type f -name ".imap.index*" -exec /bin/rm -f '{}' \;
|
||||
done
|
||||
|
||||
echo "Completed";
|
Reference in New Issue
Block a user