![]() This should give some idea of timings based on your message count. However, running it a second time, it took TWO seconds (probably due to caching). I ran this and it took 17 seconds (on read only check) to check nearly 32900 database records. Rem Modify all parameter values below where marked " & :%DataDir%\buildsql.sqlĬscript.exe //NoLogo %ScriptPath%\HMSdatabaseRecordCheck.vbs /DataDir:%DataDir% /ActionFlag:%ActionFlag% /HMSpassword:%HMSpassword% Second the calling bat file called HMSdatabaseRecordCheck.bat : ![]() Wscript.echo ("See hmailserver_events.log for more detail on the missing files.") Wscript.echo ("Rows checked : " & MessageCount - 1) Wscript.echo ("Deleted DB Rows : " & DeletedCount) Wscript.echo ("Missing eml files : " & ErrorCount) Wscript.echo (" Message checked upto: " & MessageCount)Įlog.Write ("Missing eml files : " & ErrorCount)Įlog.Write ("Deleted DB Rows : " & DeletedCount)Įlog.Write ("Rows checked : " & MessageCount - 1) If MessageCount / 1000 = INT(MessageCount / 1000) ThenĮlog.Write (" Message checked upto: " & MessageCount) SSQL = "DELETE FROM hm_messages WHERE messageid = " & MessageID If not (FSO.FileExists(CheckFilePath)) thenĮlog.Write ("File not found: " & SearchFile & ", Account: " & AccountAddr & ", MessageID: " & MessageID ) If MessageCount > 1 then ' ignores first HEADER rowĬheckFilePath = DataDir & "\" & oDomain & "\" & oAccount &"\"&SearchfileFolder&"\"&SearchFile MessageID = trim(mid(MessageInputLine,44,10))ĪccountAddr = trim(mid(MessageInputLine,54)) ![]() MessageInputLine = Replace(MessageInputLine,vbTab," ") Set oRead = oReadObj.OpenTextFile(DataDir&"\MessageList.txt", 1) Set oReadObj = CreateObject("Scripting.FileSystemObject") Set obApp = CreateObject("hMailServer.Application")Ĭall obApp.Authenticate(AdminUser, HMSpass) Set Elog = CreateObject("hMailServer.EventLog") ![]() Set FSO = CreateObject("Scripting.FileSystemObject") HMSpass = ("HMSpassword")ĭataDir = ("DataDir") Note: Modify all parameter values in the BAT script where marked " & :<- INPUT blah ", and delete all whitespace/spaces and the actual " & :<- INPUT blah " instruction from the line (after your parameter value).įirst, the VBS script called HMSdatabaseRecordCheck.vbs (that will be called from a BAT file):ĭim MessageCount, ErrorCount,DeletedCountĭim oReadObj, oRead, SearchFile, MessageInputLine, SearchfileFolder, CheckFilePath, FoundIt, AccountAddr, MessageID Note: there is a similar script for INTERNAL DATABASE hereġ, the dedicated VBS script (called 'HMSdatabaseRecordCheck.vbs')Ģ, A calling BAT file ('HMSdatabaseRecordCheck.bat')Ī, Save both scripts (with the relevant VBS and BAT extensions) into the same storage directory of your machine where you would require them to run from.ī, Modify the BAT file and enter the necessary parameters at the top of the script (there are 7 to review). It should work with other flavours of external SQL database but you would have to make the necessary amendments to paths and executable in the BAT file to suit your system. This script is for databases using an external MYSQL database and utilises both SQL commands and the Com API to ensure things are done whilst maintaining Hmailserver integrity. However, there is no feature to do the reverse - ie, check that physical files exist for every database record. If and email file is found that is not in the database then it provides the option to import the file into the database or delete the file from disk. The Data Directory Synchronizer, provided as the standard install of Hmailserver, checks physical email files in the data directory are all included in the database. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |