Mailtraq - the Complete Email Server

Enstar for Mailtraq email server sales & support
Making world-class Internet technology affordable  

Search for:

Advanced search

KB01060101 - Backup Configuration to Schedule

Notes for mtq-bak.mtq script

Configuration backup on Schedule:   DOWNLOAD

Script Installation

Copy the enclosed file mtq-bak.mtq to \database\scripts\mtq-bak.mtq

Script Registration

Console, Options, Scripts and Templates, Automated Scripting tab,
Add, select "Create" entry, click on Properties ...

Script Properties tab

  [ x ]  Enable this Script
  Description  [ System file backup ]
  Script to Execute  [ mtq-bak ]
  [   ]  Disable after execution
  Script Trigger  [ Scheduled ]

Schedule Event tab
  click Add, select "New Schedule" and click Properties ...
Schedule tab
  Event Scheduling  [ Daily ]
  Time  [ 03 ]  [ 45 ]
  (NB Select any idle time of your choice)

Ok, Ok and Done to return to the Console.

The scripting system runs as a background task. If the system fails to save an edit or update, save and then OK back to the Console, then reenter and edit

Batch Files

In addition to the batch file created by the script, a batch file named
mtq-bak.bat is required in your \database folder.

You have two options when creating this batch file. Option (a) overwrites
the previous day's backup but a dated copy of the system file itself is
always retained. Option (b) writes each day's backup to a new location.

Create one of the two following batch files as \database\mtq-bak.bat ...

Option A

@echo off
xcopy x:\path\database\configuration\*.* y:\path\backup\*.* /e /c /q /y >nul
copy x:\path\database\configuration\system.cfg y:\path\backup\system.%DAY% >nul

Option B

@echo off
xcopy x:\path\database\configuration\*.* y:\path\backup\%DAY%\*.* /e /c /q /y >nul

... where ...

"x:\path" is the drive and path to Mailtraq's database folder. In a default
installation it's "C:\Program Files (x86)\Mailtraq" - don't forget to enclose spaces in
the path in quotes as shown.

"y:\path\backup" is the desired location for backups. Ideally, a different physical
drive to either the Mailtraq installation drive or the Mailtraq database drive should
be chosen but that's not a requirement.

"%DAY%" is an environmental variable set by mtq-run.bat and picked up by mtq-bak.bat
before being set to nul again by mtq-run.bat. The current date in "yyyymmdd" format
is accessed via %DAY% by mtq-bak.bat and used to create a unique system file copy,
system.yyyymmdd, in option A or a folder named yyyymmdd in option B.

When the script is first run, the dos window fails to close automatically and must be
closed by hand. After that first run, a batch file named mtq-run.bat is left in
\database. Select that file in Explorer and choose Properties from its context menu
(right-click or Shift+F10). On the Program tab, enable "Close on exit" and future
runs of the batch file will close automatically. Note that this procedure creates a
file named \database\mtq-run with no extension which must not be removed.


The syntax of the xcopy command causes any matching files in the destination folder
to be overwritten and creates new destination folders automatically, both without
prompt or warning. 

If xcopy32 isn't available on your system, try xcopy instead but check the parameters
available to it against the batch file syntax. A simple way to do that is to run
xcopy /?>temp.txt from a dos prompt and load the resulting temp.txt file into an
editor such as notepad or textpad.

The script can be run more than once per day or can be run via Mailtraq's File, 
Run Script menu option at will for test purposes.

Jim Hill
February 2001
Updated June 2001


Keywords: kb ticker general
Mailtraq Highlights...
 SMTP Server     Mailtraq SMTP email server video IMAP Server     Mailtraq IMAP email Server video
 POP3 Server     Mailtraq POP3 email server video Proxy Server     Mailtraq proxy email server video
 Webmail Server     Mailtraq webmail email server video Mailing-list Server     Mailing list email server video
 Groupware Services     Mailtraq groupware email services video Spam and Virus control     Spam and virus control email server video


   Copyright © 2003 - 2011 Enstar Ltd, Enstar LLC & Fastraq Ltd. All rights reserved. Privacy policy.
   Mailtraq® is a registered trademark of Fastraq Limited.