Purpose of the 'hexecp' command line utility
search cancel

Purpose of the 'hexecp' command line utility

book

Article ID: 55227

calendar_today

Updated On:

Products

CA Harvest Software Change Manager - OpenMake Meister CA Harvest Software Change Manager CA Harvest Software Change Manager - OpenMake Meister

Issue/Introduction

What does the 'hexecp' command line utility do?

Environment

Harvest Software Change Manager all versions

Resolution

'hexecp' attempts to log in to a Harvest agent on a remote computer and execute a program or script.

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

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

Therefore, before executing 'hexecp', ensure that a Harvest agent is running on the target computer.

The 'hexecp' command has the following format:

hexecp -b <brokername> -prg <app or script> -m <remotehostname> -rport <remoteagentport> { -syn | -asyn } 
-usr <remote userid> -pw <remote password> -args <arguments for the app or script> 

Below is a simple Test:

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

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 the Harvest Supportability Matrix for certified/supported platforms.  

For our simple test we created a Linux shell script on the "exampleagent" server named "test.sh" which simply echoes back the contents of the "PATH" environment variable.

test.sh :

echo $PATH > path.txt

Our simple test command is this

hexecp -b examplebroker -prg /home/exampleuser/test.sh -m exampleagent rport 6000 -asyn -usr exampleuser -pw ********

-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 computer where the agent is running and our program ( test.sh ) resides

-rport is the port number on which the Harvest agent is listening

-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 computer on which the program will be executed.

Result:

hexecp -b examplebroker -prg /home/exampleuser/test.sh -m exampleagent -rport 6000 -asyn -usr exampleuser -pw ********
Attempting to log into remote agent...
Connected to remote agent.
Execution of program: /home/exampleuser/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 exampleagent in the home directory of the logged user, exampleuser ( /home/exampleuser) 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:

/opt/CA/scm/bin:/app/oracle/product/19.0.0/dbhome_1/bin:/opt/CA/SharedComponents/bin:/usr/bin:/usr/local/bin:/bin:/usr/bin

Additional Information

More information on the hexecp command can be found here: hexecp Command-Execute Program

Attachments

1558535674995TEC430281.zip get_app