The following example shows entry points written in a shell script.
The FileOnOff example entry point is simple. When the agent's online entry point is called by the agent, the entry point expects the name of the resource as the first argument, followed by the values of the remaining ArgList attributes.
Note The actual VCS FileOnOff entry points are written in C++, but for this example, shell script is used.
When the agent's monitor entry point is called by the agent, the entry point expects the name of the resource as the first argument, followed by the values of the remaining ArgList attributes.
If the file exists it returns exit code 110, indicating the resource is online with 100% confidence. If the file does not exist the monitor returns 100, indicating the resource is offline. If the state of the file cannot be determined, the monitor returns 99.
# Expects Resource Name and Pathname
. $VCS_HOME/bin/ag_i18n_inc.sh
#check if second attribute provided
#Exit with unknown and log error if not provided.
VCSAG_LOG_MSG "W" "The value for PathName is not specified"\
# Exit online (110) if file exists
# Exit offline (100) if file does not exist
This script includes the intentional offline functionality for the MyCustomApp agent.
See About on-off, on-only, and persistent resources.
Note that the method to detect intentional offline of an application depends on the type of application. The following example assumes that the application writes a status code into a file if the application is intentionally stopped.
. ${CLUSTER_HOME}/bin/ag_i18n_inc.sh
// Obtain the attribute values from ArgListValues
if [ ${RETVAL} -eq ${VCSAG_RES_UNKNOWN} ]; then
// Could not get all the required attributes from ArgListValues
// Check if the application's process is present in the ps
if [ ${REVAL} -eq ${VCSAG_RES_ONLINE} ]; then
// Application process was not found; Check if user gracefully
grep "MyCustomAppCode 123 : User initiated shutdown command" ${APPLICATION_CREATED_STATUS_FILE}
// Found MyCustomAppCode 123 in the application's status
// file that gets created by the application on graceful
exit $VCSAG_RES_INTENTIONALOFFLINE;
// Did not find MyCustomAppCode 123; hence application has
// crashed or gone down unintentionally
// Monitor should never come here
When the agent's offline entry point is called by the agent, the entry point expects the name of the resource as the first argument, followed by the values of the remaining ArgList attributes.
When the values are accepted by the entry point, the file is deleted.
# Expects ResourceName and Pathname
. $VCS_HOME/bin/ag_i18n_inc.sh
#check if second attribute provided
VCSAG_LOG_MSG "W" "The value for PathName is not specified"\