I am trying to use Hawk Event to detect the Hawk Agent's termination and configure hawkevent.cfg:-script as -script $HAWK_ROOT/bin/startagentto restart the Hawk Agent, but it does not work. What could be the problem?

I am trying to use Hawk Event to detect the Hawk Agent's termination and configure hawkevent.cfg:-script as -script $HAWK_ROOT/bin/startagentto restart the Hawk Agent, but it does not work. What could be the problem?

book

Article ID: KB0089006

calendar_today

Updated On:

Products Versions
TIBCO Hawk -
Not Applicable -

Description

Resolution:
Hawk Event is a Java application. It uses Java Runtime.exec() to fork() a new process and execute the script. Please refer to the following website.
http://www.mountainstorm.com/publications/javazine.html

1. In the JDK1.0.2 implementation, you must supply a complete path to whatever it is that you are executing. There is no facility in that version of the JDK to get the shell environment that you are running in, hence no PATH variable is known. This is fixed in JDK1.1, however it is always good practice to fully qualify the path.

2. Shell built-in commands will not work here. A prime example of this is the DOS "dir" command. This is a built-in and will not execute. You would need to use "command \c dir" as the command string.

Therefore, there two problems here.

1. (JDK version depended) In the -script option, you should not use environment variables, such as HAWK_ROOT. Please use a fully qualified path, such as
-script /tibco/bin/restartagent

2. In the default startagent script, shell build-in commands are used. You have to create a new script without using shell build-in commands. To make it simple, in startagent script add one line
echo  "$JVMEXE -DTIBHawk=agent -Dhawk.hawk_root=$HAWK_ROOT -Dhawk.cluster=$NETWORK -Dhawk.agent_domain=$DOMAIN $MSFLAG $MXFLAG $NOJIT -cp $JARFILE COM.TIBCO.hawk.agent.HawkAgent $switches &"
before the line
       $JVMEXE -DTIBHawk=agent -Dhawk.hawk_root=$HAWK_ROOT -Dhawk.cluster=$NETWORK -Dhawk.agent_domain=$DOMAIN $MSFLAG $MXFLAG $NOJIT -cp $JARFILE COM.TIBCO.hawk.agent.HawkAgent $switches &
Run startagent. The actual Java command, which starts up Hawk Agent, shows up. Copy the actual Java command and paste it into a new script file, such as restartagent. Here is an example of restaragent script file.
restartagent:
/local/tibco/jre/1.3.0/bin/java -DTIBHawk=agent -Dhawk.hawk_root=/local/tibco/hawk402
-Dhawk.cluster=10.107.202.0 -Dhawk.agent_domain=tibco.com     -cp
/local/tibco/rv6x/tibrv/lib/tibrvj.jar:/local/tibco/hawk402/java:/local/tibco/hawk402/java/activation.jar:/local/tibco/hawk402/java/agent.jar:/local/tibco/hawk402/java/ami.jar:/local/tibco/hawk402/java/config.jar:/local/tibco/hawk402/java/console.jar:/local/tibco/hawk402/java/crimson.jar:/local/tibco/hawk402/java/display.jar:/local/tibco/hawk402/java/event.jar:/local/tibco/hawk402/java/jcchart.jar:/local/tibco/hawk402/java/jkitgo.jar:/local/tibco/hawk402/java/mail.jar:/local/tibco/hawk402/java/perltools.jar:/local/tibco/hawk402/java/publisher.jar:/local/tibco/hawk402/java/rvutils.jar:/local/tibco/hawk402/java/security.jar:/local/tibco/hawk402/java/spot.jar:/local/tibco/hawk402/java/swingall.jar:/local/tibco/hawk402/java/talon.jar:/local/tibco/hawk402/java/util.jar:/local/tibco/hawk402/java/utilities.jar:/local/tibco/hawk402/java/workbench.jar:/tsi/ae/tools/rv/6.8/pro/sol28sp/sparc/lib/tibrvj.jar:/local/tibco/hawk402/java/ami.jar:/local/tibco/hawk402/java/utilities.jar
COM.TIBCO.hawk.agent.HawkAgent -file /local/tibco/hawk402/bin/hawkagent.cfg &
After restartagent is created, please run it to make sure it works.

Issue/Introduction

I am trying to use Hawk Event to detect the Hawk Agent's termination and configure hawkevent.cfg:-script as -script $HAWK_ROOT/bin/startagentto restart the Hawk Agent, but it does not work. What could be the problem?