Starting and Setting Up RTR
2.11 Running RTR as a Service on Windows NT
2.11.1 Customizing the RTR Windows NT Service
While starting RTR, the Service looks for the file
UsrStart.RTR
in the RTR home
directory. On finding the file, the Service executes any RTR commands it may
contain. RTR commands from
UsrStart.RTR
execute after RTR has been started.
From the point of view of the Service, the RTR home directory is found in the
system-level environment variable
RTR_DIRECTORY
, or, if that is not defined, then
the directory from which the Service was executed.
For the RTR Service to use it,
RTR_DIRECTORY
must be defined in the system-level
environment variables list, not the user-level environment variables list. Also,
the system must be rebooted after the definition of
RTR_DIRECTORY
is either
created or changed for it to be used.
If a user-level copy of
RTR_DIRECTORY
exists, it must identify the same RTR home
directory as the system-level copy, or if there is no system-level copy, the directory
containing the currently registered Service program. If it does not, behavior of
RTR is undefined. Changing the value of
RTR_DIRECTORY
, or reregistering the
service from another directory while RTR is running, is dangerous and should
be avoided. Starting RTR from the Service, then stopping it from DOS (or the
reverse) should also be avoided.
If you put
STOP RTR
in the
UsrStart.RTR
file, it will stop RTR. The Service will
not detect that RTR has been stopped and will offer only the STOP action button.
Pressing the STOP button will fix the problem.
Similarly, when the Service stops RTR, it searches the RTR home directory for
the file
UsrStop.RTR
and, if the file exists, execute any RTR commands in it. User
commands from
UsrStop.RTR
are executed before RTR has stopped.
WARNING
If you put QUIT or EXIT in either
UsrStart.RTR
or
UsrStop.RTR
, RTR
will exit improperly. As a result, an RTR command server process
incorrectly remains active, preventing the Service from starting or
stopping RTR, and preventing the RTR command server from exiting.
Because the RTR command server executes under the SYSTEM account,
it cannot be stopped from Task Manager other than by the SYSTEM
account.
2.11.2 Files Created by the RTR Windows NT Service
If RTR is started from the Service rather than via a Command Prompt window,
several files are created in the RTR root directory.
SrvcIn.Txt
is created to act
as a command line input source;
SrvcOut.Txt
acts as a container for console
output;
RTRStart.RTR
contains the startup commands. When the Service stops
RTR, it recreates
SrvcIn.Txt
and creates
RTRStop.RTR
for stopdown commands.
Creation of these files is unconditional; that is, they are created every time RTR
is started or stopped, whether or not they already exist. RTR will thus ignore
(and overwrite) any changes made to one of these files.
Starting and Setting Up RTR 2–17