ABAP application server instances
Read the provided information about shell scripts that allow you to start, stop, and monitor remote ABAP application server instances.
For an implementation of high availability using SA z/OS® (see Automating using IBM Z System Automation), you need the following shell scripts that allow you to start, stop, and check remote ABAP application server instances.
- start_as <Hostname> <InstDir> <InstType> <jobname> <maxretries> [<via>]
- Starts an ABAP application server instance, if <InstType> value of 0
is specified.
<jobname> is a unique job name for the start_as shell script. You must define a job name, which is different from the job name listed under Application Information of the SA z/OS proxy resource. This is required to avoid a false SA z/OS reaction on the pre-process termination exit when the script ends.
- stop_as <Hostname> <InstDir> [<via>]
- Stops an ABAP application server instance.
- check_as <Hostname> <InstDir> <InstType>
- Starts an ABAP application server monitor, if <InstType> value of 0 is specified.
These shell scripts and their parameters are described in detail in Reference of the z/OS high availability scripts.
If you are running an SAP NetWeaver kernel greater or equal to 7.38, then implement the changes described in Required changes to protected web methods of sapstartsrv.
The parameter <via> is optional. It identifies the remote execution type used to send commands to remote application servers (running under AIX®, Linux®, or Windows). If a remote application server is started or stopped, the default is SSH. So it can be set to SSH or can be omitted.
What the shell scripts do
This information unit describes the tasks performed by the shell scripts.
- start_as
-
- For the remote application server, the
start_asscript first checks if the remote host can be reached viaping. This is retried three times, while sleeping 10 seconds between attempts, so the total ping wait time is 30 seconds. Afterstart_ascan ping the host, it determines the type of the application server, which can be either AIX, Linux, or Windows. Then, it checks for an ABAP application server, whether the database server can be reached from there viaR3trans. In case of an error, the shell script indicates the status by sending a message to the system console, and then ends. Otherwise, if no error occurs, it then checks whether the instance is already running by using the IBM® utilitysamsapctrl_asping(see section samsapctrl_asping in this information unit). If the instance is running, the shell script indicates the status by sending a message to the system console, and then ends.This step protects a running application server instance from unnecessary restarts. For example, in case of an intermittent communication error,
check_asterminates and IBM Z System Automation issues thestart_ascommand again. Based on the notification of the active state message, IBM Z System Automation now startscheck_asagain.Using this approach, IBM Z System Automation only has to monitor a single process, namely the one started by
check_as. - An AIX or Linux
ABAP application server is started by invoking the following SAP standard
scripts or commands:
stopsap r3 <instance> <hostname> cleanipc <instnr> remove startsap r3 <instance> <hostname>The
stopsapandcleanipccommands ensure that orphan processes or resources are cleaned up before a newstartsapis performed. If the instance was shut down normally, thecleanipcandstopsapcommands do nothing and end immediately. - Finally, the script checks periodically until the application server instance is running and
responding to
samsapctrl_asping. You can configure the maximum number of periodical checks using parameter<maxretries>. If the first check is unsuccessful the script retries for 10 *<maxretries>seconds. Successful startup is indicated by sending a message to the system console.Example: With
<maxretries> = 24, the script gives up after 240 seconds and returns a STARTUP FAILED message. If starting the Java™ application server takes longer in your environment, you must use a higher<maxretries>counter. - An AIX or Linux
Java application server is started by invoking the following
SAP standard scripts or commands:
stopsap j2ee <instance> <hostname> cleanipc <instnr> remove startsap j2ee <instance> <hostname> - A Windows application server is
started with following SAP standard
executables:
stopsap name=<SID> nr=<instance number> SAPDIAHOST=<hostname> startsap name=<SID> nr=<instance number> SAPDIAHOST=<hostname>
- For the remote application server, the
- stop_as
-
- The ABAP application server is stopped by invoking the following script for AIX and Linux:
stopsap r3 <instance> <hostname>For Windows, the ABAP application server is stopped by invoking the following SAP executable:stopsap name=<SID> nr=<instance number> SAPDIAHOST=<hostname>
- The ABAP application server is stopped by invoking the following script for AIX and Linux:
- check_as
-
- The health check of the application server is done by requesting health status information via
the
sapcontrolinterface of the AS instance. Thesapcontrolinterface is periodically called by using thesamsapctrl_aspingutility (see section samsapctrl_asping in this information unit). The parameter<InstType>specifies, for which application server type the monitor is started. A value 0 starts an ABAP application server (AS) monitor and a value of 2 starts a Java AS monitor.A failure of
samsapctrl_aspingindicates that there is (or was) a problem with that instance. Therefore, the existence of thesamsapctrl_aspingprocess is used by System Automation to determine the status of the application server instance.The script creates a link to the
samsapctrl_aspingexecutable such as./AS_ABAP_ping_<hostname>_<instance number>in the current directory for an ABAP application server, or./AS_Java_ping_<hostname>_<instance number>in the current directory for a Java application server.In the SA z/OS policy for the respective resource application, edit the z/OS UNIX Control options. For correct monitoring via SA z/OS:
- The z/OS UNIX path should be
/bin/sh - The z/OS UNIX filter should be
./AS_ABAP_ping_<hostname>_<instance number>for an ABAP application server, or./AS_Java_ping_<hostname>_<instance number>for a Java application server.
- The z/OS UNIX path should be
- The health check of the application server is done by requesting health status information via
the
- samsapctrl_asping
-
- This utility uses the SAP's
sapcontrolinterface of the application server instance to get its health status. The command-line parameters allow you to choose between different modes. It must be installed in the home directory of the<sid>admuser. - The default option is that
samsapctrl_aspingends after it gets a response from thesapcontrolcall for the ABAP or Java application server instance. This is used in thestart_asscript to check whether an application server instance is up and running. - Another option specifies that
samsapctrl_aspingcontinues to run and checks the status periodically (the default is 30 seconds) viasapcontrolcalls. It only ends ifsapcontrolindicates a bad health status of the application server. Additionally, ifsapcontrolreturns with a timeout after 30 seconds, for example because of a connection problem,sapsapctrl_aspingperforms up to two retries. If each retry ends with a timeout,sapsapctrl_aspingends after the third timeout. This mode is used in thecheck_asscript to monitor an ABAP or Java application server instance. samsapctrl_aspinguses a message file. This file has the name sapolicy.sap.map_USS. It must be installed in the same directory as thesamsapctrl_aspingscript, namely in the home directory of the<sid>admuser.
- This utility uses the SAP's
Invoking remote execution
SSH is the only remote execution type for the start and stop scripts that are used to control remote application servers. OpenSSH is the implementation of a secure shell, which allows different methods of authentication. It is available as a Program Product for z/OS and as an Open Source product on most other platforms including Linux and AIX. Under Windows, the scripts have been tested using the Tectia SSH Client/Server product, version 6.4, from the SSH Communications Security company, as a sample SSH client/server implementation.
OpenSSH uses hardware support to
generate random numbers. This requires ICSF and ICSF must be started with
/dev/random support prior to starting OpenSSH. More information on this topic can
be found in Using hardware support to generate random numbers.
In
the start_as script, the remote execution command is run in background.
For more detailed information, refer to the following websites and documentation: