Dienstag, 31. März 2015

AIMS / MapGuide backup batch script

I used to create backups for the repository files and the library - by running the batch files provided by MapGuide manually and using the Admin web interface for creating a package. To simplify the process I have written one batch file for the whole procedure. As I'm not familiar with batch file scripting there is probably lots of space for improvements left. Here are some details:


1. make package 
I modified the existing "makepackage.php" script (...\Autodesk Infrastructure Web Server Extension 2013\www\mapadmin) in order to run it from command line. It needs some configuration parameters such as path to webconfig.ini and the Administrator's credentials (MapGuide Admin).

2. repository backup batch files
The backup scripts provided by MapGuide need a little modification - I added an "exit" at the end of each of the files I use and renamed them as well (kept the originals).

 ...  
 echo.  
 php -n RepositoryAdmin.php -c Restore -i "%cd%\..\BackupRepositories\Library\LastColdBackup" -o "%cd%\..\Repositories\Library"  
 echo.  
 exit  

  
3. batch script 
One batch script is needed to run all other scripts, for shutting down and restarting MapGuide service and for copying the backed up files to a different drive.

To run other batch files use:

 ...  
 start /wait call %batch_file_backup%  
 if ERRORLEVEL 1 goto error_start  
 ...  


This will run another batch file and wait until the batch file has finished. If the batch file does not finish succesfully you can catch an error code. A modification of the original batch files provided by Mapguide is required to get this to work - see above.

One click and files are backed up:


backup batch file in action

Script files are available here.

Install:

1) Copy files to "..\Autodesk Infrastructure Map Server\RepositoryAdmin" folder.
2) check and modify settings in "makepackagescript.php"
3) check and modify settings in "AIMS_backup.bat"
4) run "AIMS_backup.bat"

This should work for AIMS 2013 and the corresponding MGOS version.

1 Kommentar:

  1. if you are useing a different version of MapGuide than 2013 then do not use the three modified scripts included in the download package but use the existing scripts from your installation and add the "exit" command at the end of each of the three files. there are some difference between 2013 and 2015 batch files as I just have learnt.

    AntwortenLöschen