Distributing script files to remote computer (Linux)


PATROL for Scripting enables you to use custom scripts to monitor your environment. You can execute scripts remotely or locally as per your requirement. If script files do not exist on remote computer, PATROL for Scripting copies the respective script to the remote computer for execution. 

Script files that are to be distributed to different remote computers must be located at the %PATROL_HOME%\TRO\Conf\Scripts\ScriptFileTransfer\Devices directory. The configured script file to be executed will be copied from this location to the remote device. 

To save your scripts in a user defined folder in the devices directory

To execute specific scripts on particular devices, perform the following: 

  1. In the %PATROL_HOME%\TRO\Conf\Scripts\ScriptFileTransfer\Devices directory, create a new folder with the configured device name
  2. Place the script files for the respective remote device in the newly created folder. 

If the script files do not exist on the remote device, they are obtained from the user defined folder in the Devices directory or from the parent directory (ScriptFileTransfer) directory.

ZIP and TAR file formats are supported. If you want to execute a script that has dependencies on other files, create a ZIP or a TAR file with the required files and the script. The ZIP or TAR files will be copied to the remote device.

Example

Suppose /root/allScripts/myScript/systemHealth.sh is the script file you want to execute on the myDevice remote device.

If the script file does not exist on the myDevice remote device, the KM checks if it exists on the monitoring system. The KM,

  • checks if the systemHealth.sh file exists at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.sh or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.sh location
  • checks if a .zip file with the same name as the script file exists at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.zip or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.zip location
  • checks if a .tar file with the same name as the script file exists at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.tar or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.tar location. 

Notes

If the script is found on the monitoring system it will be copied automatically to the remote device.

  • If the script path on the remote device does not exist, it will be created automatically.
  • Compressed and archive files (ZIP/TAR) must contain the script files for execution. Compressed and archive files (ZIP/TAR) are extracted on the remote device.
  • File permissions are changed to 700, that is, administrator can read, write and execute the script.

Similar instructions on how to save your scripts to the Devices directory are documented at %PATROL_HOME%\TRO\Conf\Scripts\ScriptFileTransfer\Devices\Readme.txt. The file contents are as follows:

#######################################################################################################################################################
##
##    ## Instructions ##
##
##    Script files transfer:
##    ######################
##
##    A. The configured script to execute will be copied from this location if the
##        script does not exist on the remote server.
##
##    B. Create a new folder with the name of the configured device within the Devices directory and place all of
##        the remote device unique scripts that you would like to execute for this device.
##        If the script does not exist on the remote device, it will be taken from the
##        device directory that you created or from the parent directory named ScriptFileTransfer.
##
##    C. Compress file ZIP and archive file TAR are supported as well, if you would like to execute a script that
##        contains a dependencies to other files, you can create a .zip file or a .tar file that will gather
##        all of the files including the script file. those files will be copied to the remote device.
##
##        Example:
##        --------
##        Assuming that the script file that you would like to execute on the remote device named myDevice is:
##            /root/allScripts/myScript/systemHealth.sh
##
##        If the script does not exist on the remote device named myDevice we will check if it is exist on the
##        monitoring system accordantly:
##
##            1. Check if systemHealth.sh file exist on the %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.sh
##                or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.sh
##
##            2. Check if there is a .zip file with the same name as the script file in the location:
##                %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.zip
##                or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.zip
##
##            3. Check if there is a .tar file with the same name as the script file in the location:
##                %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.tar
##                or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.tar
##
##
##                Notes:
##                -----
##                1. Based on this order, if the script found on the monitoring system it will be copied automatically
##                    to the remote device
##
##                2. If the script path on the remote device does not exist, it will get created automatically
##
##                3. Compress and archive files (ZIP/TAR) must contains the script file to execute
##
##                4. Compress and archive files (ZIP/TAR) will be extracted on the remote device
##
##                5. Files permissions will be changed to 700 (owner can read, write and execute)
##
## ####################################################################################################################################################

To save your scripts in the current directory

To execute specific scripts on particular devices, perform the following: 

  1. In the %PATROL_HOME%\TRO\Conf\Scripts\ScriptFileTransfer\Devices directory, create a new folder with the configured device name
  2. Place the script files for the respective remote device in the newly created folder. 

If the script files do not exist on the remote device, they are obtained from the user defined folder in the Devices directory or from the current directory.

ZIP and TAR file formats are supported. If you want to execute a script that has dependencies on other files, create a ZIP or a TAR file with the required files and the script. The ZIP or TAR files will be copied to the remote device.

Example

Suppose /root/allScripts/myScript/systemHealth.sh is the script file you want to execute on the myDevice remote device.

If the script file does not exist on the myDevice remote device, the KM will check if it exists on the monitoring system. The KM,

  • checks if the systemHealth.sh file exists at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.sh or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.sh location
  • checks if a .zip file with the same name as the script file exists at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.zip or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.zip location
  • checks if a .tar file with the same name as the script file exists at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.tar or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.tar location. 

Notes

If the script is found on the monitoring system it will be copied automatically to the remote device.

  • If the script path on the remote device does not exist, it will be created automatically.
  • Compressed and archive files (ZIP/TAR) must contain the script file to execute. Compressed and archive files (ZIP/TAR) are extracted on the remote device.
  • File permissions are changed to 700, that is, administrator can read, write and execute the script.

Similar instructions on how to save your scripts to the Devices directory are documented at %PATROL_HOME%\TRO\Conf\Scripts\ScriptFileTransfer\Readme.txt. The file contents are as follows:

#######################################################################################################################################################
##
## ## Instructions ##
##
## Script files transfer:
##
##    A. The configured script to execute will be copied from this location if the
##       script does not exist on the remote server.
##
##    B. Create a new folder with the name of the configured device within the Devices directory and place all of
##       the remote device unique scripts that you would like to execute for this device.
##       If the script does not exist on the remote device, it will be taken from the
##       device directory that you created or from the current directory.
##
##    C. Compress file ZIP and archive file TAR are supported as well, if you would like to execute a script that
##       contains a dependencies to other files, you can create a .zip file or a .tar file that will gather
##       all of the files including the script file. those files will be copied to the remote device.
##
##       Example:
##        --------
##       Assuming that the script file that you would like to execute on the remote device named myDevice is:
##            /root/allScripts/myScript/systemHealth.sh
##
##       If the script does not exist on the remote device named myDevice we will check if it is exist on the
##       monitoring system accordantly:
##
##            1. Check if systemHealth.sh file exist on the %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.sh
##                or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.sh
##
##            2. Check if there is a .zip file with the same name as the script file in the location:
##                %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.zip
##                or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.zip
##
##            3. Check if there is a .tar file with the same name as the script file in the location:
##                %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/Devices/myDevice/systemHealth.tar
##                or at %PATROL_HOME%/TRO/Conf/ScriptFileTransfer/systemHealth.tar
##
##
##                Notes:
##                -----
##                1. Based on this order, if the script found on the monitoring system it will be copied automatically
##                    to the remote device
##
##                2. If the script path on the remote device does not exist, it will get created automatically
##
##                3. Compress and archive files (ZIP/TAR) must contains the script file to execute
##
##                4. Compress and archive files (ZIP/TAR) will be extracted on the remote device
##
##                5. Files permissions will be changed to 700 (owner can read, write and execute)
##
##
## ####################################################################################################################################################

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*