Product Documentation

Database Administrator's Guide

Previous Topic

Next Topic

PROCESS_EXIT_COMMAND

PROCESS_EXIT_COMMAND <command>

Used to run a command when the FairCom DB process calls the system function exit(). Before running the command, FairCom DB sets the following environment variables:

CTREE_PROCESS_ID is set to the FairCom DB process ID.

CTREE_SHUTDOWN_STATE is set to one of the following database engine shutdown status codes:

0 Shutdown not initiated.

1 Shutdown initiated.

2 Shutdown completed, but some clients remain active.

3 Shutdown completed with all files closed and final checkpoint logged.

Description

At shutdown the server calls the application indicated by the PROCESS_EXIT_COMMAND keyword within that application. It is possible to access the CTREE_PROCESS_ID and the CTREE_SHUTDOWN_STATE environment variables that exist within the scope of that application.

Example:

Create test.bat in the server executable directory, containing the following:

@echo %CTREE_PROCESS_ID% > shutdown.txt

@echo %CTREE_SHUTDOWN_STATE% >> shutdown.txt

Add this line to ctsrvr.cfg:

PROCESS_EXIT_COMMAND .\test.bat

Start the server and then stop it.

The content of shutdown.txt (created by test.bat) will be something like the following:

27700

3

Where 27700 indicates the c-tree server PID and 3 is the shutdown state (clean shutdown).

TOCIndex