Documentation
AUTOMATIC MYSQL BACKUP:  V2.0


Preleminary Material for review

System Requirements

  • Perl 5
  • Crontab

Preliminaries

  • Determine the path to PERL 5 on your web server host.  Note that some web hosting companies run both PERL 4 and PERL 5.  Make ABSOLUTELY sure you are not setting this up under PERL 4.  Ask your administrator if you are not sure.
  • Download the tarfile for this program and save it to your desktop. 
  • Unpack the tar archive on your desktop using a program that unpacks UNIX TAR ARCHIVES. If you don't have such a program then download WINZIP FREE from SHAREWARE.COM
  • After you have unpacked the TAR archive you will have a collection of folders and files on your desktop.  Now you have to do some basic editing of each of these files (or at least some of them).  Use a text editor such as wordpad, notepad, BBEdit, simpletext, or teachtext to edit the files.  These are NOT WORD PROCESSOR DOCUMENTS they are just simple TEXT files so don't save them as word processor documents or save them with extentions such as .txt or they will NOT WORK.   Note that there may be a some files inside of folders which are "blank".   This is normal.

Preparing the CGI scripts

Define Path To PERL 5

The first step is to open up each and every file that has a .cgi extention and edit line number one of each script.  Each of the cgi scripts is written in perl 5. For your scripts to run they must know where perl 5 is installed on your web server. The path to perl 5 is defined to a cgi script in the first line of the file. In each of the cgi scripts the first line of code looks something like this:

#!/usr/bin/perl

If the path to perl 5 on your web server is different from /usr/bin/perl you must edit the first line of each cgi script to reflect the correct path. If the path to perl 5 is the same no changes are necessary. If you do not know the path to perl 5 ask the webmaster or system administrator at your server site.  

Configure the .cgi files

mysqlbackup.cgi

Everything you need to do is right inside here (see where it says "USER CONFIGURATION AREA")

  • $mysqldatabasename = "enter name of your database";
  • $mysqlusername = "enter your mysql username";
  • $mysqlpassword = "enter your mysql password";
  • $mysqldump = "/full/path/to/mysqldump";
  • $backupdir = "/full/path/to/backup/storage/directory/";

Upload files and set permissions

Upload the mysqlbackup.cgi script into your cgi-bin.  Set the permission on this file to 755.  Create a crontab file to execute mysqlbackup.cgi how ever often you wish to backup.  If you use this script in conjunction with "Nightly Backup" for remote backup make sure mysqlbackup.cgi executes and has time to COMPLETE before nightly backup executes.   You will find all the backed up files inside of $backupdir dated by month and day.  Clear them out by deleting them manually whenever you desire.  It's a good idea to keep a few backups just in case your database gets messed up.  That way you can always go back in time and try to repair problems.

Crontab

See the tutorial for information on crontab