--- smeserver-dirty-tools-0.0.9/root/sbin/e-smith/dt-dovecot-indexfiles-delete.bug_4001 2008-03-01 10:29:59.000000000 +0100 +++ smeserver-dirty-tools-0.0.9/root/sbin/e-smith/dt-dovecot-indexfiles-delete 2008-03-01 10:30:34.000000000 +0100 @@ -1,12 +1,18 @@ -#!/usr/bin/perl -# (C) 2007 Michael Weinberger +#!/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. -print "Deleting Dovecot imap index files\n"; +echo "Deleting Dovecot's index files"; + +USERS=`/usr/bin/find /home/e-smith/files/users -type d -maxdepth 1` # users +USERS="/home/e-smith/ $USERS" # admin +for u in $USERS; do + ! /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 -system('cd /home/e-smith/files/users; /usr/bin/find -maxdepth 4 -type f -name ".imap.index*" -print0 | /usr/bin/xargs -0 /bin/rm -f'); -system('cd /home/e-smith/Maildir; /usr/bin/find -maxdepth 2 -type f -name ".imap.index*" -print0 | /usr/bin/xargs -0 /bin/rm -f');