--back up or front down?

ScriptSuite™
Back Me Up v1.0

Rate this program at
The Perl Archive

Download:
By downloading and installing Back Me Up v1.0, you agree to indemnify, defend, and hold harmless Tintagel Net Solutions Group, Inc. dba Script Solutions from any and all liability, penalties, losses, damages, costs, expenses, attorneys' fees, causes of action or claims caused by or resulting indirectly from your use of this script which damages either you, or any other party or parties without limitation or exception. This indemnification and hold harmless agreement extends to all issues associated with this script.

By downloading and installing Back Me Up v1.0, you agree not to sell, modify or redistribute the source code. You also agree to keep our authorship and copyright statements intact.

Back Me Up v1.0 (4k) Last Updated: 99/09/23


Background:
Do you have a file you wish you could make regular backups of? A database, file, log, whatever?

Does your web host delete your account's raw access logs regularly? Raw access logs keep track of visitors to your web site. Pages visited, time visited, referring information (if available) and much more information is stored in a web site's access logs. Most domain and web hosting companies that offer access logs regularly delete previous logs. This is due to the extremely large files that access logs become. Because this information is often used to determine your online marketing efforts, you may wish to download and study your raw access logs.


Objective:
Back Me Up v1.0 offers you 2 methods of viewing/downloading your files you'd like to back up. One is extremely simple -- simply point your web browser to the location you install and either download it from your browser or have it saved elsewhere on your server. The other way is to have crontabs* perform the tasks for you.


Requirements:
In addition to the standard requirements, you need to have a web host that:

  1. UNIX based server (Though this program may work on NT, Solaris, or other server, it has not been tested.)
  2. Has crontabs* enabled (for automatic file copying)
  3. Offers telnet access (if using crontabs)
  4. Has a mail program (Optional)

*Crontabs are programs that run in the background at set intervals. Many hosts do not have crontabs enabled, or enable them only on request. Crontabs will be necessary if you wish to have the file to be backed up automatically copied to a location on your account for later review.


Installation:
Installing Back Me Up is easy. Please follow these simple steps:

  1. Download Back Me Up v1.0
  2. Unzip the program using your favorite unzip program.
  3. Open the bmu.cgi and edit the following lines:

    $website = "scriptsolutions.com";
    Change this line to your hosting account. If you have a web host, and a url that looks like http://www.mindspring.com/~thisisme, then enter ~thisisme. If you have your own domain, and your url that looks like http://www.scriptsuite.com/, then enter scriptsuite.com.

    $backup_file = "/home/scriptsolutions/access-log";
    Change this line to the full server path to the file you want backed up.

    $path = "/home/scriptsolutions/www/cgi-bin/bmu";
    Change this to the full server path of the directory you're going to upload Back Me Up to. If you don't know the exact path, telnet to your account and type pwd in the directory that you're going to install Back Me Up to. After you hit enter, you will get the path to the directory you're currently in. Enter that path in $path. If you don't have telnet access, either FTP into your account and navigate to the directory you're going to install Back Me Up into. Look at the path to that directory and enter the path in $path.

    $backup_path = "/home/scriptsolutions/www/cgi-bin/bmu/data";
    Change this to the full path of the directory that you want the backup files created in. Please note that some servers do not allow files to be created and written to in the cgi-bin. If this is the case on your server, make sure you set $backup_path to a directory into which Back Me Up can create and write files.

    $create_copy = "1";
    This is the line that defines how your program will behave. Please understand how the program works by reviewing Back Me Up's usage. In general, if you have crontabs enabled on your account, and want to have the file automatically backed up, keep this setting as 1. This will copy the file to the path you defined in $backup_path automatically.

    You would also want to use 1 if you don't want to use crontabs, but want to back up a file manually by visiting bmu.cgi in your web browser.

    The only time you would want to use $create_copy = ""; is if you simply want to use Back Me Up to view the file from your browser and perhaps save the file with a File, Save As.

    $create_copy = ""; # don't make copy
    $create_copy = "1"; # make copy

    $action = "append";
    If you entered 1 in $create_copy above, do you want to create a new file for each backup, or would you like each backup to be added to the previous backup (append the backup file)? Recommended: Back up only once a day, at the end of the day, if you want separate daily logs.

    Use:
    $action = "append";#if you want to append the file

    Or use;
    $action = "new";# if you want a new file for each backup.

    $notify_by_mail = "1";
    This is extremely useful if you use crontabs to copy your access log ($create_copy = "1";). This will send you a confirmation email that your log has been copied. If you prefer not to receive this confirmation, remove the 1 from the parenthesis. Example:
          $notify_by_mail = "";

    $email = 'fwseries@scriptsolutions.com';
    If you set $notify_by_mail = "1"; above, enter the email address that you want to receive these confirmations to.

    $mailprog = "/usr/sbin/sendmail";
    Enter the full path to your mail program. If you do not know the location to your sendmail program, telnet to your account (if you have telnet access) and type whereis sendmail. This will return the path to your sendmail program.

  4. After you've made the above changes, save the file and open your favorite FTP program.
  5. Upload both bmu.cgi and bmuconfig.cfg in ASCII format into your cgi-bin or other executable directory.
  6. Change permissions on bmu.cgi to 755. You can either change permissions using your FTP program (if that's a feature of your FTP program) or by telnet. Please review your FTP program's documentation to learn how to do this using your FTP program. If you wish to change permissions by telnet, telnet to your account and navigate to the directory you uploaded Back Me Up into. Then type chmod 755 bmu.cgi
  7. If you do not have crontabs enabled, you're done. Point your web browser to your installation of bmu.cgi any time you want a backup (or to view) the file.
  8. Crontab users:
    1. Make sure you have crontab access
    2. Find out from your server administrator what time they prefer for you to run cron jobs.
    3. If you're backing up your access log file, find out from your server administrator what time the access log is deleted, so you could back it up before then. Please note that all "hits" to the access log from the point of backing up to the point your administrator deletes the log will be lost.

    If you're familiar with crontab usage, simply create an entry, pointing directly to the bmu.cgi. Assuming the file paths in the mbuconfig.cfg are correct, you're done. It's suggested that you test Back Me Up in your browser a couple of times before you completely rely on it. Just make sure you receive any errors, and that the file is being backed up correctly. Precautionary measures ensure no data loss.

    If you're unfamiliar with crontab usage, a sample crontab entry is included in the distribution (cop.txt). This sample schedules the crontab to run at 11:55pm nightly. To install it, first open cop.txt in a text editor and change the path to bmu.cgi to your server's path to where you installed bmu.cgi. After saving, upload the revised cop.txt to your web server. Telnet to your account, and navigate to the directory into which you uploaded cop.txt. Type:

    crontab cop.txt

    then hit "enter". If after hitting "enter", you receive an error similar to "bash: crontab: command not found", then your web server does not have crontabs enabled -- contact your server administrator. If after hitting "enter", you receive another plain command prompt, type:

    crontab -l

    then hit "enter". If you see the line that's listed in cop.txt, you're all set. Log off.

    A crontab tutorial is at The Perl Archive


Usage:
The proper usage of your Back Me Up v1.0 depends on what you entered in $create_copy in Back Me Up.cgi and what method you're using to access Back Me Up.cgi.

Browser
If $create_copy = "1", you will receive a page that says "File Copied". The copy of the log will be in the directory you specified in $backup_path

If $create_copy = "", your $backup_file will be printed to your browser window.

New File or Append
You have the choice to continually append your backup file, or create a separate file for each daily backup.

Crontab
If $create_copy = "", nothing will happen. Your log will not be copied and you will not receive an email. Do NOT use this setting.

If $create_copy = "1", your entire access log will be copied at the time you specified in your crontab. The file will be named according to the date it was copied in YYMMDD.txt format. If you selected $notify_by_mail = "1";, you will receive an email confirmation (at the email address you specified in $email) that your access-log has been copied.


Support:
Because BackMeUp is a freeware program, we offer limited free support. Support Information and Options.

Program Info
  Main Page
--------------------

Perl Diver
(Updated 12/26/02!)

Domain Director
(Updated 12/24/02!)

My Domain Host is YourDomainHost!
Find out why!
[an error occurred while processing this directive]