DataDirectorySynchronizer for individual account

This section contains scripts that hMailServer has contributed with. hMailServer 4 is needed to use these.
Post Reply
gsmaclean
Normal user
Normal user
Posts: 47
Joined: 2008-04-16 18:35

DataDirectorySynchronizer for individual account

Post by gsmaclean » 2008-04-21 00:33

Needing to run DataDirectorySynchronizer on an individual account (not on every account on the system), I wrote the attached script to do so. Martin started off with a small script to do adds only, and I added to it to give it add/delete functionality and error checking.

The code is not the cleanest around, but I needed it fast - it does work.

Just run it, enter your admin password and the email address you want to synchronize, and it will do the rest.

First, it scans through the database. If it finds any messages in the database for that account that don't have corresponding .eml files on disk, it deletes the message from the database.

Second, it scans through the .eml files on disk. If it finds any .eml files that don't have corresponding entries in the database, it adds them to the database.

It's not the fastest thing in the world, but it does work - I tested it several times on my test installation, and then I went ahead and used it on the user account I had to restore on my production box - and it worked perfectly.

One thing I did notice is that hMailServer does not know about the added/deleted messages until the hMailServer service is stopped and restarted - even if the database performance caching is disabled. I added a warning message to this effect.
Attachments
SynchronizeAccount.zip
DataDirectorySynchronizer for an individual account
(1.89 KiB) Downloaded 737 times

tayyem
New user
New user
Posts: 1
Joined: 2008-05-31 07:33

Re: DataDirectorySynchronizer for individual account

Post by tayyem » 2008-05-31 07:37

Hi

I have tried to download the attachment but forbidden message appears, please check the links and permissions.

Thanks

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Re: DataDirectorySynchronizer for individual account

Post by ^DooM^ » 2008-05-31 11:06

tayyem wrote:Hi

I have tried to download the attachment but forbidden message appears, please check the links and permissions.

Thanks
Works fine for me.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

gsmaclean
Normal user
Normal user
Posts: 47
Joined: 2008-04-16 18:35

Re: DataDirectorySynchronizer for individual account

Post by gsmaclean » 2008-05-31 15:36

tayyem wrote:Hi

I have tried to download the attachment but forbidden message appears, please check the links and permissions.

Thanks
Works for me as well, perhaps you have a virus checker or something blocking it?

Post Reply