Using script entry points

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 without C++

  1. Create the directory /opt/VRTSvcs/bin/FileOnOff:

    # mkdir /opt/VRTSvcs/bin/FileOnOff

  2. Use the VCS agent /opt/VRTSvcs/bin/ScriptAgent as the FileOnOff agent. Copy this file to /opt/VRTSvcs/bin/FileOnOff/FileOnOffAgent, or create a link.

    To copy the agent binary:

    # cp /opt/VRTSvcs/bin/ScriptAgent

    /opt/VRTSvcs/bin/FileOnOff/FileOnOffAgent

    To create a link to the agent binary:

    # ln -s /opt/VRTSvcs/bin/ScriptAgent

    /opt/VRTSvcs/bin/FileOnOff/FileOnOffAgent

  3. Implement the online, offline, and monitor entry points using scripts.
    1. Using any editor, create the file /opt/VRTSvcs/bin/FileOnOff/online with the contents:

      # !/bin/sh

      # Create the file specified by the PathName

# attribute.

touch $2

    1. Create the file /opt/VRTSvcs/bin/FileOnOff/offline with the contents:

      # !/bin/sh

      # Remove the file specified by the PathName

# attribute.

rm $2

    1. 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

  1. Create the directory %VCS_HOME%\bin\FileOnOff:

C:\> md %VCS_HOME%\bin\FileOnOff

  1. Use %VCS_HOME%\bin\VCSdefault.dll as the agent DLL.

    Copy the file to %VCS_HOME%\bin\FileOnOff.dll, as shown below:

C:\> copy %VCS_HOME%\bin\VCSdefault.dll

%VCS_HOME%\bin\FileOnOff\FileOnOff.dll

  1. Implement the online, offline, and monitor entry points using scripts. The examples below use shell scripts. MKS Toolkit or equivalent software is required for running shell scripts. Entry points can also be implemented as batch files.
    1. Using any editor, create the file%VCS_HOME%\FileOnOff\online.sh with the following contents:

# Create the file specified by the PathName

# attribute.

touch $2

    1. Create the file %VCS_HOME%\bin\FileOnOff\offline.sh with the following contents:

# Remove the file specified by the PathName

# attribute.

rm $2

    1. Create the file %VCS_HOME%\bin\FileOnOff\monitor.sh with the following contents:

# Verify that file specified by PathName

# attribute exists.

if test -f $2

then exit 110;

else exit 100;

fi

  1. 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.