1 |
--- smeserver-affa-0.9.0/root/sbin/e-smith/affa.dovecotDeleteNewStyleIndexFiles 2008-03-03 19:04:04.000000000 +0100 |
2 |
+++ smeserver-affa-0.9.0/root/sbin/e-smith/affa 2008-03-03 19:04:26.000000000 +0100 |
3 |
@@ -71,7 +71,8 @@ |
4 |
sub getStatus(); |
5 |
sub getStatusRaw(); |
6 |
sub hTime2Timestamp($); |
7 |
-sub imapIndexFilesDelete( ); |
8 |
+sub imapIndexFilesDelete(); |
9 |
+sub imapIndexFilesDeleteCommand(); |
10 |
sub installedRPMsList($); |
11 |
sub installWatchdog(); |
12 |
sub isMounted($$); |
13 |
@@ -1950,6 +1951,18 @@ |
14 |
); |
15 |
ExecCmd( @cmd, 0 ); |
16 |
} |
17 |
+ |
18 |
+ if( $job{'remoteHostName'} eq 'localhost' ) |
19 |
+ { |
20 |
+ imapIndexFilesDelete(); |
21 |
+ } |
22 |
+ else |
23 |
+ { |
24 |
+ $txt="Deleting Dovecot's index files on $job{'remoteHostName'}"; lg( $txt ); print "$txt\n"; |
25 |
+ @cmd=("/usr/bin/ssh", '-o', "HostKeyAlias=$jobname", '-p', $job{'sshPort'}, $job{'remoteHostName'}, "'" . imapIndexFilesDeleteCommand() . "'" ); |
26 |
+ ExecCmd( @cmd, 0 ); |
27 |
+ } |
28 |
+ |
29 |
$txt="Signaling post-upgrade event on $job{'remoteHostName'}"; lg( $txt ); print "$txt\n"; |
30 |
if( $job{'remoteHostName'} eq 'localhost' ) |
31 |
{ |
32 |
@@ -1960,6 +1973,7 @@ |
33 |
@cmd=("/usr/bin/ssh", '-o', "HostKeyAlias=$jobname", '-p', $job{'sshPort'}, $job{'remoteHostName'}, "/sbin/e-smith/signal-event", "post-upgrade"); |
34 |
} |
35 |
ExecCmd( @cmd, 0 ); |
36 |
+ |
37 |
$txt="Signaling reboot event on $job{'remoteHostName'}"; lg( $txt ); print "$txt\n"; |
38 |
if( $job{'remoteHostName'} eq 'localhost' ) |
39 |
{ |
40 |
@@ -2624,14 +2638,17 @@ |
41 |
return $size; |
42 |
} |
43 |
|
44 |
+sub imapIndexFilesDeleteCommand() |
45 |
+ { |
46 |
+ return 'USERS=`/usr/bin/find /home/e-smith/files/users -type d -maxdepth 1`;USERS="/home/e-smith/ $USERS"; for u in $USERS ; do ! /usr/bin/test -d $u/Maildir && continue; /usr/bin/find $u/Maildir -maxdepth 2 -type f -name ".imap.index*" -exec /bin/rm -f \'{}\' \; ; /usr/bin/find $u/Maildir -maxdepth 2 -type f -name "dovecot.index*" -exec /bin/rm -f \'{}\' \; ; done'; |
47 |
+ } |
48 |
+ |
49 |
sub imapIndexFilesDelete() |
50 |
{ |
51 |
# Sometimes Dovecot index files are corrupted after a restore |
52 |
# It is save to delete them all. Dovecot will rebuild them when the mailbox is accessed. |
53 |
- print "Deleting Dovecot imap index files\n"; |
54 |
- my @cmd=('cd /home/e-smith/files/users; /usr/bin/find -maxdepth 4 -type f -name ".imap.index*" -print0 | /usr/bin/xargs -0 /bin/rm'); |
55 |
- ExecCmd( @cmd, 0 ); |
56 |
- @cmd=('cd /home/e-smith/Maildir; /usr/bin/find -maxdepth 2 -type f -name ".imap.index*" -print0 | /usr/bin/xargs -0 /bin/rm'); |
57 |
+ print "Deleting Dovecot's index files\n"; |
58 |
+ my @cmd=( imapIndexFilesDeleteCommand() ); |
59 |
ExecCmd( @cmd, 0 ); |
60 |
} |
61 |
|