Creates a backup of a mirth configuration
Purpose:This code template creates a backup of a mirth configuration like if you click "backup config" in the settings tab of the mirth administrator and stores it in the filesystem.
It backs up the whole mirth configuration and also the configuration map. Everything is compressed into a zip archive and can optionally be secured with 256bit AES encryption.
Parameters:
- username
The username that the channel should use to connect to the server that should be backed-up. Dedicated user is recommended. - password
The password that the channel should use to connect to the server that should be backed-up. - server
The ip or name of the mirth server that should be backed-up. It can also contain a custom port (default is 8443). This parameter will become part of the backup name. - backupFolder
Path to the folder where the backup should be created. None-existing parts of the path will be created. Further, all backups of the same day will be placed in a dedicated subfolder. - archivePassword
If a password is set, the resulting archive will be secured by 256bit AES encryption (Optional)
Examples:
Create a backup archive without encryption:
backupMirthServer('admin', 'admin', 'MyMirthProdInstance', 'c:\temp');
Create a 256bit AES encrypted backup archive:
backupMirthServer('admin', 'admin', 'MyMirthProdInstance', 'c:\temp', 'MySecurePassword!');
Configuration:
- Place the zip4J library in the custom-lib folder of mirth. (It is needed for zip encryption - further info can be found on the website)
- Press the button "Reload Resources" under Settings -> Resources in Mirth Administrator
- Import the attached code templates
Intelligently remove outdated backups from your backup folder to avoid exceeding the capacity of the backup drive.
This function should be called in the backup channel after all Mirth servers have been backuped.
Parameters:
- path
The path to the directory that should be cleaned up. (This usually is the path of the backup folder) - maxFileAge
Subdirectories that are older than the here specified number of days (1st day is today) will be deleted if number of resulting directories is not below the minimum specified by minNumberOfBackups - minNumberOfBackups
The minimum number of backups that should be kept even if the maximum file age is exceeded (optional)
Examples:
Remove all backups that are older than 40 days:
cleanupDirectory('c:\temp', 40);
Remove all backups that are older than 20 days but retain at least the 10 last backups:
cleanupDirectory('c:\temp', 20, 10);