Database backup¶
Features¶
This is a small program developed in Gradle with the following features
- Perform MySQL database backups (using mysqldump utility);
- Compress backup files to ZIP format, reducing file sizes up to 10% of this original size;
- Mantain a history of backup files from the last 7 days;
- Transmit the compressed backup file to another server by FTP (optional);
- Work in Windows, Linux or any other operating system supported by a Java Virtual Machine;
Installation¶
The backup utility is executed as a Gradle script file. So it's necessary to have Gradle instaled:
- Download Gradle 1.6 here
- The recommended directory structure is
\MSH \backup \gradle-1.6 \scripts
- Extract the Gradle zip file to the gradle-1.6 folder.
- Include Gradle bin folder (\MSH\gradle-1.6\bin) to the system path. For instructions on how to do that in Windows, click here, and for Linux based operating systems, click here
- Download the file scripts.zip at http://www.etbmanager.org/download/package/scripts.zip
- Extract its content to the \MSH\scripts folder
Configuration¶
Open the file \MSH\scripts\gradle.properties in a text editor and configure the parameters
databaseName = etbmanager
backupDir = backup
mysqldump = C\:\\Program Files\\MySQL\\MySQL Server 5.5\\bin\\mysqldump.exe
ftpServer = ftp.etbmanager.org
ftpUser = username
ftpPassword = password
ftpDir = /
FTP Upload: If you don't want to have the backup file uploaded to another server, just remove the ftpServer parameter from gradle.properties file
Running the backup¶
In Windows, in order to run the backup, open the command line window and go to the \MSH\scripts folder. There execute the backup.bat batch file:
C:\msh\scripts> backup.bat
In Linux, open a terminal window, go to the \MSH\scripts folder and run
$ gradle --build-file backup.gradle
Automatic backup execution¶
In Windows Server:- Go to Administrative Tools | Task Scheduller;
- In the Task Scheduller window, create a new Basic Task, and in the action field, point it to the backup.bat

- Important: In the Start In field, set the \MSH\scripts folder;
- It's also recommended that you create a new user in Windows Server (specific for schedulled tasks) and assign the task to this user
For Linux servers, consult the documentation of your distribution on how to set schedulled tasks to call the command \msh\scripts\gradle --build-file backup.gradle