I have written a simple VB script that would stop the services of hMailServer and MySQL, then do the back up on hMailServer Data as well as the Data in MySQL Database, and then finally restarted the services.
The script goes as follows
Code: Select all
Set objShell = CreateObject("WScript.Shell")
objshell.run("net stop ""hMailServer""")
objshell.run("net stop ""mysql""")
sourceDataStr = "C:\Program Files\hMailServer\Data"
destDataStr = "E:\hMailServer\Data"
sourceSQLStr = "C:\AppServ\MySQL\data\hmailserver_db"
destSQLStr = "E:\hMailServer\mysql daily backup"
' Back up Email Data
strDataCmd = "robocopy " & Chr(34) & sourceDataStr & Chr(34) & " " & Chr(34) & destDataStr & Chr(34) & " /M"
objShell.Run strDataCmd
' Back up mysql database
strSQLCmd = "robocopy " & Chr(34) & sourceSQLStr & Chr(34) & " " & Chr(34) & destSQLStr & Chr(34) & " /MIR"
objShell.Run strSQLCmd
objshell.run("net start ""hMailServer""")
objshell.run("net start ""mysql""")
WScript.Quit
Since I schedule the task to run overnight, the hMailServer will not get started until I come in the next day. I wonder if anyone might be able to share some of your expertise with me.
Any help would be greatly appreciated.
Thank you