Example: Using script entry points on UNIX
The following example shows how to build the FileOnOff agent without writing and compiling any C++ code. This example implements the online, offline, and monitor entry points only.
Example: implementing entry points using scripts
-
Create the directory
/
opt/VRTSvcs/bin/FileOnOff:
mkdir /opt/VRTSvcs/bin/FileOnOff
-
Use the VCS agent /opt/VRTSvcs/bin/Script50Agent as the FileOnOff agent. Copy this file to the following path:
/opt/VRTSvcs/bin/FileOnOff/FileOnOffAgent
or create a link.
To copy the agent binary:
cp /opt/VRTSvcs/bin/Script50Agent
/opt/VRTSvcs/bin/FileOnOff/FileOnOffAgent
To create a link to the agent binary:
ln -s /opt/VRTSvcs/bin/Script50Agent
/opt/VRTSvcs/bin/FileOnOff/FileOnOffAgent
-
Implement the
online
, offline
, and monitor
entry points using scripts. Use any editor.
-
Create the file
/opt/VRTSvcs/bin/FileOnOff/onlin
e with the contents:
# !/bin/sh
# Create the file specified by the PathName
# attribute.
touch $2
exit 0
-
Create the file
/opt/VRTSvcs/bin/FileOnOff/offline
with the contents:
# !/bin/sh
# Remove the file specified by the PathName
# attribute.
rm $2
exit 0
-
Create the file
/opt/VRTSvcs/bin/FileOnOff/monitor
with the contents:
# !/bin/sh
# Verify file specified by the PathName attribute
# exists.
if test -f $2
then exit 110;
else exit 100;
fi
-
Additionally, you can implement the
info
and action
entry points. For the action
entry point, create a subdirectory named "actions" under the agent directory, and create scripts with the same names as the action_tokens within the subdirectory.