Recently one of my Mitel SME Server clients took two weeks off. When he returned, Outlook Express told him he had 23,000 messages waiting on the server! Unfortunately, Outlook Express couldn't bring any of those messages to his PC; it just hung.
It's not unusual for Outlook Express to have problems like that. For example, if you don't delete messages from your Inbox AND purge deleted messages, you will eventually reach the point where Outlook can't bring in any messages at all. I don't know for sure how Outlook Express works, but it sure looks like it trys to bring everything into memory before it writes anything to disk. That this is incredibly naive doesn't need to be expanded upon. Anywhere, there we were, dead in the water. I tried having him change to IMAP from POP, but the same thing happened: Outlook Express just could not bring down the messages.
So, I ssh'ed into the machine and performed the following:
cd ~jpg # user name cd Maildir mv new newx mkdir new chown jpg:jpg new chmod 755 new
It would have been preferable to do this in single user mode, but I wasn't able to be there physically. I suppose we have a small possibility of an error delivering mail in the brief period that the mailbox does not exist, and I could have (and perhaps should have) stopped the qmail server before doing this. However, if some process was actively delivering mail it would have just ended up in newx (because "newx" would retain "new"'s inum) and the worst that could happen is that a message or two would bounce. As I said, better to do this single user, but this was probably OK.
Why move this like this? Two reasons: first, "new" had become unreasonably large, which would slow down both deliveries and pickups in the future - creating a new directory puts it back to reasonable size. Second, any new mail arriving after this would be easily picked up by Outlook Express because it would end up in "new", not "newx".
Now the problem was to move the messages back in, but slowly so that he would have time to delete the junk and file off the rest. The following script did the job:
cd /home/e-smith/files/users/jpg/Maildir/newx for i in * do mv $i /home/e-smith/files/users/jpg/Maildir/new/$i sleep 2 done
I ran this as "nohup movejpg &" so that I could log out after starting it. This will transfer 30 messages a minute back to "new", which should be slow enough for him to keep up. Of course this will take more than 10 hours to complete! I felt that was probably OK - some of the messages would transfer after hours, but that should be a small enough number that Outlook wouldn't choke the next day. And of course if it is - we'll just do it again!
It might have been impossible to do the "for i in *" if there had been tooo many more messages; in that case "xargs" would have let me control the scripts.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-03-19 Tony Lawrence
If debugging is the process of removing bugs, then programming must be the process of putting them in. (Edsger W. Dijkstra)