Show TOC

Background documentationWorking with User Exit Locate this document in the navigation structure

 

The instance control hook command is called before or after starting or stopping an SAP application server instance, whereas the database control hook command is called before or after starting or stopping a database.

Using argument format identifiers, you can control the arguments that are appended to the program.

Format Identifier

Argument Description

%p

Hook name will be expanded to "prestart", "poststart", "prestop", "poststop"

%h

Hostname (the hostname which is assigned to the application)

%t

Application type. For example: DB, SAP

SAP Instance specific

%n

Instance number

%s

SAP system identifier (SID)

Database specific

%s

Database Name

For example, starting an SAP application server instance with SID C11, instance number 00, and instance hostname cic11 results in the following hook command calls (assuming the instance control hook command parameter is defined as described above):

/usr/sap/hostctrl/exe/instance_control_hook.sh prestart C11 00 cic11

<instance start operation>

/usr/sap/hostctrl/exe/instance_control_hook.sh poststart C11 00 cic11

By evaluating these arguments, the script can perform operation and application service- specific tasks.

On UNIX, the hook command is called in the context of the corresponding SAP system administrator user (<sid>adm).

On Windows, the hook command is called in the context of the local system account.

The host agent evaluates the exit code of the hook command to determine the result of the command and to decide whether the start or stop operation should be continued or not. The exit codes are interpreted as:

Exit Code

Description

0

Hook command terminated successful

4

Hook command terminated with warning

Else (any other exit code)

Hook command terminated with error

The execution of the operation is continued if the hook command terminated is successful or with warning. The operation is aborted if the hook command is terminated with error.