1 |
--- smeserver-dirty-tools-0.0.9/root/sbin/e-smith/dt-dovecot-indexfiles-delete.bug_4001 2008-03-01 10:29:59.000000000 +0100 |
2 |
+++ smeserver-dirty-tools-0.0.9/root/sbin/e-smith/dt-dovecot-indexfiles-delete 2008-03-01 10:30:34.000000000 +0100 |
3 |
@@ -1,12 +1,18 @@ |
4 |
-#!/usr/bin/perl |
5 |
-# (C) 2007 Michael Weinberger |
6 |
+#!/bin/bash |
7 |
+# (C) 2008 Michael Weinberger |
8 |
# See http://wiki.contribs.org/Dirty_Tools for full documentation |
9 |
|
10 |
# Sometimes Dovecot index files are corrupted after a restore |
11 |
# It is save to delete them all. Dovecot will rebuild them when the mailbox is accessed. |
12 |
|
13 |
-print "Deleting Dovecot imap index files\n"; |
14 |
+echo "Deleting Dovecot's index files"; |
15 |
+ |
16 |
+USERS=`/usr/bin/find /home/e-smith/files/users -type d -maxdepth 1` # users |
17 |
+USERS="/home/e-smith/ $USERS" # admin |
18 |
+for u in $USERS; do |
19 |
+ ! /usr/bin/test -d $u/Maildir && continue |
20 |
+ /usr/bin/find $u/Maildir -maxdepth 2 -type f -name "dovecot.index*" -exec /bin/rm -f '{}' \; |
21 |
+ /usr/bin/find $u/Maildir -maxdepth 2 -type f -name ".imap.index*" -exec /bin/rm -f '{}' \; |
22 |
+done |
23 |
|
24 |
-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'); |
25 |
-system('cd /home/e-smith/Maildir; /usr/bin/find -maxdepth 2 -type f -name ".imap.index*" -print0 | /usr/bin/xargs -0 /bin/rm -f'); |
26 |
|