This first category of automation scripts includes scripts that are associated with a process command. These scripts are referred to as start-of-run and end-of-run scripts. Start-of-run scripts are only applicable to runs started by the service without any outside interference, specifically runs that are started by the service’s scheduler. This includes runs that are launched when the service is started in response to the run_at_startup parameter for a data source. End-of-run scripts on the other hand are applicable to all runs.
Client runs that are started from DBConsole, Batch Console, and BCNOTIFY do not look for start-of-run scripts.
Both types of scripts follow strict filename conventions, as follows.
where source is the data source name in lowercase letters and ext is the file extension (.cmd for Windows or .sh for UNIX).
The service searches for these script files in the scripts subdirectory in the service’s working directory. (For information about the working directory, see "The Working Directory" in the DATABridge Installation Guide.) Before a scheduled run is started, the service looks for the existence of a start-of-run script. When the service finds a script, it runs it and then starts the process command after the script is complete. If the script does not exist, the process command is started without issuing any errors or warnings. When the service determines that the process command is complete, it checks for the existence of an end-of-run script and runs it.
If a client run ends because of an error, the end-of-run script will run only after the service’s built-in error recovery has been executed. The service has a built-in recovery mechanism for responding to errors and non-zero exit codes. In situations that are temporary or self-resolving, the service will attempt the failed operation only after a brief delay. For example, if a connection to the server or database fails, the service will pause for a specified amount of time before attempting to reconnect, and will do so repeatedly until the server or database becomes available. (The parameter sched_retry_secs determines the initial retry interval. For connect failures, this interval doubles on each subsequent retry until it reaches a maximum value of 5 minutes. You can set this parameter value from the Client Console by configuring the Processing > Error Recovery settings in the Client Configuration dialog box.)
Both start-of-run and end-of-run scripts are passed the following set of parameters:
For start-of-run scripts, run_type is always 1, indicating a process command. For end-of-run scripts, run_type can be 1, 2 (clone command), 7 (redefine command), 8 (generate command) or 4 (Client Configurator run).