Project

General

Profile

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:

  1. Download Gradle 1.6 here
  2. The recommended directory structure is
    \MSH
      \backup
      \gradle-1.6
      \scripts
    
  3. Extract the Gradle zip file to the gradle-1.6 folder.
  4. 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
  5. Download the file scripts.zip at http://www.etbmanager.org/download/package/scripts.zip
  6. 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:
  1. Go to Administrative Tools | Task Scheduller;
  2. In the Task Scheduller window, create a new Basic Task, and in the action field, point it to the backup.bat

  1. Important: In the Start In field, set the \MSH\scripts folder;
  1. 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

backup1.png (11 KB) Ricardo Memoria, 05/08/2013 11:50 AM

backup2.png (6.97 KB) Ricardo Memoria, 05/08/2013 11:50 AM

backup3.png (5.71 KB) Ricardo Memoria, 05/08/2013 11:50 AM