Asynchronous remote Installation
Calling sapinst, long operation runtime is expected, therefore it is a good idea, to execute the operation asynchronously.
The SAP Host Agent support an asynchronous mode for almost all operations. The argument -timeout (or setup in the interface the SAPHostControlOperationOptions.mTimeout) is used to control this behavior.
/usr/sap/hostctrl/exe/saphostctrl
-host DestinationHost
-user sapadm abcd1234
-function ExecuteInstallationProcedure
-inifile hostagent.mf
-home /tmp
-prodid 4711
-mountsrc SourceHost:/opt/exports
-mounttgt /tmp/sapinst
-cleanup auto
-result flat
-timeout 0
Webmethod returned successfully
Operation ID: 00199905BD8F1DEE9DA22B7747488D29
|
The operation was now started with the argument -timeout 0 and the method returns immediately (wait for 0 seconds).
The Operation ID contains the unique ID identifying the executed operation.
To get the results of the operation, you can call the method GetOperationResults as reported below.
./saphostctrl
-user sapadm abcd1234
-function GetOperationResults
-id 00199905BD8F1DEE9DA22B7747488D29
Error: Command execution failed. (fault code: 127 )
Operation ID: 00199905BD8F1DEE9DA22B7747488D29
----- Response data ----
description=Mount installation source
exitcode= 0
description=Create execution directory
exitcode= 0
description=Adapt ownership
exitcode= 0
description=Create inifile
exitcode= 0
description=Adapt ownership
exitcode= 0
description=Ensure write permission
exitcode= 0
Result=HOME : /tmp/sapinst2009_07_20_11_40_28
description=Execute installation
**** Executing sapinst in /tmp/sapinst2009_07_20_11_40_28 ****
SAPINST_EXECUTE_PRODUCT_ID= 4711 SAPINST_START_GUI= false SAPINST_START_GUISERVER= false SAPINST_SKIP_DIALOGS= true
using Product ID SAPINST_EXECUTE_PRODUCT_ID= 4711
Ini File : inifile.xml
--------------------------------
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 9
Step 10
--------------------------------
Finish
Last Step Failed
exitcode= 255
|
GetOperationResults returns the results of the operation executed before.
Every call to GetOperationResults can also be executed asynchronously. In this case the argument -timeout 0 (or the number of seconds to wait) has to be provided.
Asynchronous remote Installation with retry and -function ReadLogFile
This example shows the commands for windows you have to execute step by step when you install asynchronously on a remote host:
saphostctrl.exe
-host MyHost.MyDomain
-user sapadm abcd1234
-function ExecuteInstallationProcedure
-prodid NW_DiagnosticsAgent:NW731.IND.PD
-paramfile C:\smdinstallparameters
-home C:\temp
-mountsrc \\host\swpm_windows
-mounttgt U:
-mountusr sapadm
-mountpwd abcd1234
-timeout 0
sapcontrol.exe
-host MyHost.MyDomain
-user sapadm abcd1234
-nr 99
-function ReadLogFile C:\temp\sapinst2014_06_02_11_11_30\sapinst.log
saphostctrl.exe
-host MyHost.MyDomain
-user sapadm abcd1234
-function ExecuteInstallationProcedure
-prodid NW_DiagnosticsAgent:NW731.IND.PD
-paramfile C:\smdinstallparameters
-home C:\temp\sapinst2014_06_02_11_11_30
-mountsrc \\host\swpm_windows
-mounttgt U:
-mountusr sapadm
-mountpwd abcd1234
-retry
-cleanup auto
saphostctrl.exe
-host MyHost.MyDomain
-user sapadm abcd1234
-function GetOperationResults
-id AAAABBBB
-timeout 0
|
No comments:
Post a Comment