What does the 'hexecp' command line utility do

Document ID : KB000055227
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

The 'hexecp' command executes the program specified by the -prg argument, on the machine specified by the -m argument, with options specified by the -args argument.

Solution:

'hexecp' attempts to log in to an agent and execute a program.

If no agent is found on the machine you have designated after the -m option, the following message will be received:

"An agent for < machinename> cannot be found."

Therfore, before executing 'hexecp', ensure that an agent is running on the target machine.

The 'hexecp' command has the following format:

hexecp  { -b  name -prg program -m  machinename} { -syn | -asyn } 
{ -usr  username -pw password} [-args arguments...] [-v] [-prompt] 
[-i inputfile.txt | -di inputfile.txt] [-er filename] 
[-o filename | -oa filename] [-arg] [-wts] [-h]

Below is a simple Test:

We will be running the hexecp program on a Windows host machine with the Harvest Client installed, connecting to a broker on Windows (harvestbroker), and running a program against an agent on LINUX (hardev1).

Similarly, you could invoke a program on any other platform, as long as the Harvest agent is supported on that platform. Some exceptions may apply. Refer to SupportConnect compatibility matrix for certified/supported platforms .

What does the program test.sh do?

test.sh :

echo $PATH > path.txt

When executed, test.sh writes the contents of environment variable $PATH to a file path.txt . The file test.sh is located on the agent machine (hardev1) .

hexecp -b harvestbroker -prg /disk4/har71/test.sh 
-m hardev1 -asyn -usr har71 -pw harvest123

-b is the brokername (machine name where the broker service is running)

-prg is the complete path and file name of the program to be executed

-m is the machine where the agent is running and our program ( test.sh ) resides

-asyn specified asynchronous mode (Required: -syn and -asyn are mutually exclusive and one is required.)

Note: -usr and -pw are not your Harvest username and password, but rather the username and password for the machine that the program will be executed on.

Result:

hexecp -b harvestbroker -prg /disk4/har71/test.sh 
-m hardev1 -asyn -usr har71 -pw harvest123
Attempting to log into remote agent...
Connected to remote agent.
Execution of program: /disk4/har71/test.sh was successful.
hexecp has been executed successfully.

When hexecp is executed with the above parameters, it attempts to login to the agent on hardev1 and executes test.sh . Once the hexecp execution is complete, you can verify that the file path.txt was created on hardev1 in the home directory of the logged user, har71 ( /disk4/har71) directory.

The contents of the file, path.txt, will be the value of $PATH evironment variable for the logged in user, har71.

Contents of path.txt file that was created with our test case above:

/disk4/har71/harvest/bin:/disk1/orcl920/OraHome1/bin:/disk4/har71/cacrypto:/disk4/har71/bin:/opt/CA/SharedComponents/bin:/usr/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/disk4/har71/bin

Other Relevant Information:

To learn more on the commandline utility "hexecp", see Chapter 2 of AllFusion Harvest Change Manager Reference Guide.

File Attachments:
TEC430281.zip