Sun Java System Portal Server 7.1 Developer's Guide

Introduction to Robot Completion Scripts

After the robot has finished with all the entries in the enumeration-pool and has finished all outstanding processing, you can specify additional programs to execute by enabling the cmdHook parameter.

The cmdHook is provided as a way for you to extend the shutdown phase of the robot. For example, you might want the robot to send email after it completes one run, start another process, analyze its own log files, write a small report, and so on.

When the robot has finished all outstanding processing, it will call the executable specified in the cmdHook setting. If the onCompletion parameter is set to idle or quit, the script is called once before the robot shuts down or goes idle. If the parameter is set to loop, the script is called each time the robot restarts. See the log samples in Monitoring cmdHook Execution.

The cmdHook script can be written in any language (as a Perl or shell script, a C program, and so on). If you choose to use a C program, you’ll have to insert the cmdHook parameter in the robot.conf file manually, as the search engine Administration Interface does not scan binary executables.

The cmdHook script is run from the robot’s execution environment. This means your script will inherit any environment variables set by the robot and will not have access to environment variables that might be set by your search server or the administration server. The cmdHook script will be executed from webcontainer-base/portal. This is important to keep in mind if you are using any relative directory references.

There are two examples provided in PortalServer-base/samples/robot directory. They are a simple touch test (cmdHook0) and an email upon completion (cmdHook1) scripts.