Datatrend Software - Digitizing software and CGI Scripts

DataTrend Software
CGI Scripts


AutoContact
AutoFollowUp
AutoMail
AutoMail Lite
Bookkeeper Lite
CountDown
CountDown Lite
CountLink
Script Feedback


PERL/CGI Books

 Bookkeeper Lite Readme File
Book-keeper Lite
----------------

This script is useful for keeping track of log files on your
website without having to actually go to the site to check
them.

It is set up to run only once a day, between midnight and a
time that you specify, and must be triggered by another
script (like a counter or other cgi tracking script).

For example: If you have a counter on a page that is
activated often, you can insert a code snippet (in file
snippet.cgi) that will check for the trigger time during
each counter activation. If the trigger time is met, the
Book-Keeper code is called. It checks to be sure that the
maintenance functions haven't been performed yet that day,
and then performs the following for each file you specify.
1. Emails it to you.
2. Backs it up.
3. Resets the file (clears it to 0 bytes)

Each file can have it's own settings (some can be mailed,
others can be reset etc..)

Installation
############

Installation of this script is a little more confusing than
most because it needs another script to run, but if you
follow the instructions carefully, it'll work great for you.
There are 4 parts to the installation:
1. FILE DETAILS
2. SCRIPT DETAILS
3. CONFIGURATION FILE DETAILS
4. TRIGGER FILE DETAILS

FILE DETAILS
############

Upload the following files, chmod them as indicated:
bookkeeper.pl, 0644 or higher

In a directory "bookkeeper", off of your script directory
bookkeeper.cfg, 0644 or higher
last.cfg, 0666 or higher

Create a backup directory off of your script directory if
you want to use the backup feature.

SCRIPT DETAILS
##############

In the main script file (bookkeeper.pl), make the following
changes and modifications.
-----
$mailprog
This is the location of your sendmail program.
Your system administrator can tell you where this is if
you don't know.
$mailprog = '/usr/lib/sendmail';
-----
$date
This is your date program. Your system admin can
help you with this one also if you have questions.
$date = '/bin/date';
-----
$config_file
This is the location of the config file
The contents of this file are described below.
$config_file = './bookkeeper/bookkeeper.cfg';
-----
$one_email
Set this to 'yes' or 'no'. 'yes' if you want
all files to be sent to you in one email, or 'no' if you
want the each file in a separate email. Notice the lower
case letters.
$one_email = 'no';
-----
$email_to
This is to whom the email, if any, should be sent.
$email_to = 'you@yourmail.com';
-----
$email_from
This is the reply-to email that will be sent with the
Book-Keeper emails.
$email_from = 'webmaster@yoursite.com';
-----
$email_subject
This is the subject of any emails that are sent.
$email_subject = 'Bookkeeper Report';
-----
$backup_dir
This is the backup directory if that option is chosen.
$backup_dir = './backup/';

CONFIGURATION FILE DETAILS
##########################

This is an example of a configuration file (bookkeeper.cfg)
with 4 entries.

#######
File1name|./dir1/|file1.txt|1|1|1|
File2name|./dir2/subdir2/|file2.log|1|1|1|
File3name|./dir1/|file3.txt|1|1|0|
File4name|./dir1/|file4.cnt|1|0|1|

#######

Between each pipe '|' symbol is a config option.

File1name
This is the name of the file you are managing. This
doesn't have to be the actual filename.

./dir1/
This is the location of the file. In this example, the
file is in a directory "dir1", which is a subdirectory of
where your script is. If you want to name each directory
independent of the script, do so like this:
/dir1/subdir1/subdir2/
Notice the ending "/" symbol in all cases.
The base directory is usually where your "index" or "home"
html documents are. This notation on our site would point to
http://www.datatrendsoftware.com/dir1/subdir1/subdir2/

file1.txt
This is the actual name of the file.

The next three numbers do the following:
1st switch, 1=email it, 0=don't email it
2nd switch, 1=back it up, 0=don't back it up
3rd switch, 1=reset it, 0=don't reset it.

Setting all three to 0 will cause the script to do nothing.
Notice that the last characters in the line must be a '|'
followed by a hard return.

TRIGGER FILE DETAILS
####################

A small file maintenance script needs to be inserted into a
counter file (or ANY script that gets called regularly on your
site) in order to activate the Book-Keeper to perform
the maintenance. This script checks the time and if it is
between midnight and the hour that you set, it will call
the Book-Keeper. If you don't recieve any hits between
midnight and the trigger time, the Book-Keeper will not
activate.

If your site is very busy, set the trigger cut-off time to
1 or 2 am. If your site is slow, set it to 5 or 6 am. The
objective here is to be sure that it triggers every day,
but not to have the Book-Keeper script run every single time
someone visits your site, especially during peak hours,
which will slow down your site.

You must specify the following in the trigger
code (snippet.cgi):

$triggercutoff = 5;
This is the last hour that the Book-Keeper can be triggered.

$datecmd = '/usr/bin/date';
Your unix system date command.

AutoContact|AutoMail|Bookkeeper|CountDown|CountLink|
Script Home|Script Feedback


Send mail to info@datatrendsoftware.com with questions about this web site or our products.
Copyright © Datatrend Software.
PO Box 80471, Raleigh, NC USA 27623.
800-536-6951 toll free fax