|
Program Control through File tdbengine.ini
Every time the tdbengine is executed, the program reads the file tdbengine.ini at first. The behavior of tdbengine is widely defined by this file. It must be in the same directory as the tdbengine (or file tdbengine.exe).
The ini file is searched for in these directories:
- Folder of the .prg - file
- Folder of the (executable) tdbengine(.exe)
- Folder /etc/tdbengine
Under Windows step 3 does not apply.
The file tdbengine.ini is organized in the format of Windows configuration files, which contains lines of the form "key=value" in compartments. These compartments are defined by expressions in square brackets.
The first of these compartments [globals] contains the general settings. Following entries are possible (please pay attention to upper/lower case):
Disabling the cgi-activities of tdbengine
stopcgi=0|1
location=url
If the entry stopcgi is set to 1, then no CGI program is executed, but the page displayed, which is set as location. If no location is given, then the output "cgi-execution is stopped" is generated.
Definition of global semaphore, which is used, when none of your own semaphores is set for a program
sema=name
timeout=xxxxx
overrun=url
The name may consist of maximum 64 characters. Before executing the CGI program, the tdbengine waits till the semaphore with the given name is free to occupy it then in its turn. Presently binary semaphores are exclusively involved therein, which can be used by one process only. Such a semaphore defines, that only one process is simultaneously active. The semaphore concept replaces the network routines of the TurboDatenbank. If databases are simultaneously used with the network version of the VDP (or of the TurboDatenbank), a special multiuser version of the tdbengine-package is available.
Note: The control of semaphores is much faster than the traditional file and record locking.
If the enabling does not occur within the time specified by timeout (milliseconds), the executing is interrupted and instead of this the page is executed, which is given in overrun.
It is denoted by the name "nosema" that none of semaphore is set for the CGI program.
Advise: Read-only database query systems like encyclopedia-searching etc. require no semaphores. Only if write accesses are simultaneously made to databases, semaphores must be set.
Enabling log file maintenance
logcgi=0|1
If function logcgi is set to 1, every CGI call is protocolled in the file cgi.log (in the directory of the tdbengine): date and time of the call, time for the data transfer to CGI program, execution time, time for the data transfer to the client, name of the program.
Setting the logfile
log=<path to the logfile>
Usually the logfile named "cgi.log" is created in the same directory where tdbengine(.exe) is in. This can be overridden here. This way you can have more restrictive rights on the tdbengine - folder.
Defining CGI buffer
cgibuf=nnnn
To avoid superfluous jams due to a bad (=slow) transmission to a client, the tdbengine buffers the output data to the client. nnnn is the size of the buffer in bytes (Minimum = 1024).
Setting directories
libpath=SearchPath
This entry defines a search path, which is used by the access of certain libraries in a program with USES and no complete path is entered. The separate components of the search path can be separated with ";" or ":".
semadir=directory for semaphores
In this directory the semaphores are created as files. Preset value is ./
Default values
Following values are preset, if no tdbengine.ini is available or the corresponding entries are lacking under [globals}:
[global]
stopcgi=0
sema=cgi
timeout=10000
logcgi=1
log=<installation directory>/log.cgi
semadir=./
libpath=
cgibuf=65535
cdmode=0
errorlog=<installation directory>/error.log
Programbased entries
An compartment of its own can be defined for each program, these entries overwrite the ones under [globals]. Following entries are possible here:
stopcgi
location
sema
timeout
overrun
cgibuf
The name of the compartment is the same as the program name but without extension.
Note: Function stopcgi overwrites the equal value from [globals] only, if this is set to 0 there, otherwise all programs will be stopped.
Example:
A simple tdbengine.ini could have, for example, the following appearance:
[globals]
stopcgi=0
location=http://my.host.de/reconstruction.html
sema=cgi
timeout=5000
overrun=http://my.host.de/overrun,html
logcgi=1
libpath=/home/tdbengine/utils:/dos/c/vdp/lib
semadir=sema
[MyProgram]
sema=SpecialCase
timeout=1000
overrun=http://www.anywhere.com/overrun.html
cgibuf=200000
...
Advices - Advices - Advices
Example: A CGI program must not run during reorganization of the data base. This is easy to achieve by the following sample of program:
VAR ini : STRING ini:='/home/tdbengine/bin/tdbengine.ini'
SetIdent(ini,'globals.stopcgi','1')
Pause(100) / safety first!
...
// Reorganizing is performed here
...
SetIdent(ini,'globals.stopcgi','0')
Therefore a write right must be indeed granted to the anonymous http-user for writing to tdbengine.ini.
|