IT definitions, discussions and more
Daily backup script for MDaemon (or other servers)
Here I will present a simple backup script for MDaemon mail server on windows 2003 in a simple, fast and efficient way.
The good thing about MDaemon server that you can simple backup the configuration & mail folders and then replace it on a freshly installed server and you get the same mail server you have before, so why not making a script to back these folders automatically.
Please note that to use this script you must configure MDaemon to start as a windows service.
Below is a simple batch file containing commands to stop the MDaemon, backup files & folders then start MDaemon again. In this batch file I use the NTbackup solution, but ofcource you can replace this with a simple xcopy batch file. I always prefer NTbackup for compression and verification.
Suppose you have a disk E: that you will take backup on, the following script will create a folder for backup every day.
Create a folder in C:\ and name it C:\scripts , then Open notepad and place the following commands and save them as backup.bat
echo Mail Server Windows Backup Started at: %date%_%time% >>BackupLog.txt
C:\Windows\system32\NTBACKUP.EXE backup “@C:\scripts\WinBackup.bks” /n “MAILBACKUP” /d “MAILBACKUP %date% %time%” /v:yes /r:no /rs:no /hc:off /m normal /j “Mail Server Daily Backup” /l:s /f “E:\%date%\MAILBACKUP.bkf”
echo Mail server Windows Backup Completed at: %date%_%time% >>BackupLog.txt
This will create new folder and rename it by today’s date and place the backup “MAILBACKUP.bkf” inside it. Remember to create the BKS file for the NTbackup program (e.g. winbackup.bks) in the scripts folder which will include the MDaemon folders. For more information refer to my post on windows 2003 backup.
The first command is stop the MDaemon service and the last command is to start the MDaemon service again.
I use the echo commands to create a log file of the backup.
I hope this gave you an idea on automating backup secripts, and you can use it in other servers, for example sql server by stopping the service, copy the database files then starting the sql service again.
If you like this article the please leave a comment and if you would like to share with an article or a tip please send it to ” firstname.lastname@example.org “