This document describes the OS commands interpreter(osgidm.osop.agent.jar), which allows firing of OS-specific commands on the OSGi device through the legacy Remote Manager management script.

The recent releases of Remote Manager - since version 6.0 - have adopted the Groovy scripting language for defining the management actions, as explained in Scripting in Remote Manager. However, the legacy commands described below can still be used. 


Basic Principles

RM provides a script language that delivers universal means for device management within the scope of RM. As the OSGi device management has its specifics, the script language holds commands specially designed to meet them. Using these commands, you can manage large sets of OSGi devices quite easily by just writing the right script definition and executing it when needed.

Commands

The RM management script defines a command as the main composite unit that stands for a management operation over a device or its components. For example, a command could be installing a bundle on a device, setting a system property, creating a bundle configuration, etc.
Commands could be single or composite. A single command is the definition of a single management action. Composite commands are formed of several single commands and/or other composite commands.

OS Commands

These commands perform OS-specific operations.

COPYFILE Command

This command copies the specified file from one location to another. Its syntax is:

target.executeLegacy("COPYFILE <src_location> <dest_location>")

For example:

target.executeLegacy("COPYFILE \"http://localhost/bundles/wmlsc.jar\" \"c:\\mydir\\wmlsc.jar\" ")

OSEXEC Command

This command executes an OS-specific command on the device host. Its syntax is:

target.executeLegacy("OSEXEC <OS_command>")

For example:

target.executeLegacy("OSEXEC \"notepad c:\\test.txt\" ")

Support for execution of OS Commands is an optional feature of RM's OSGi device management package. The OSGi devices where these commands will be executed should have the OS Commands Interpreter bundle(osgidm.osop.agent.jar) installed and running. This bundle will be automatically installed and started if you check the "OS Commands Support" check-box when registering the device.

GETFILE Command


The GETFILE command uploads a file from a managed OSGi device to the backend. The syntax of this command is:

target.executeLegacy("GETFILE [-timestamp] [-keep-old] \"<file>|<dir>\" [\"<backend_root>\"]")

 where:

  • <file> and <dir> stand for the file or the directory on the device local system to upload on the backend as a result from the command execution. Use "
    " as file separator.

In the specified backend root directory (see the next paragraph), each device has a separate directory allocated for its files. This directory is named after the device ID assigned by RM at device registration.

  • <backend_root> is an optional parameter, which specifies the root directory on the backend where the uploaded file will be stored.

If backend root is not specified in the GETFILE command, then the one denoted with the prm.getfile.root system property in the default.prs file (from the /bin/mserver directory) of the management server framework is used. If neither of them is specified, then current directory where RM is running is set as root.

  • -timestamp is an option, which enables appending of a time stamp to the name of every downloaded file. The resulting name has the form <file>.yyyy.MM.dd_HH_mm_ss, where yyyy.MM.dd_HH_mm_ss is the time of downloading.
  • -keep-old preserves the name of the newly downloaded file (when not combined with -timestamp) without overwriting the already existing one with the same name (if there is such). Instead it renames the existing file to <file>.yyyy.MM.dd_HH_mm_ss, where yyyy.MM.dd_HH_mm_ss represents the time of file creation (last modification).

Prerequisites to have the GETFILE command working:

  • On the management server - you need the GETFILE-Command Handler bundle (/packages/osgidm/osgidm.osop.getfile.be.ms.jar) running in the backend. By default, it is activated when the system is initially started.
  • On the OSGi device - you need the OS Commands Interpreter bundle, provided as osgidm.osop.agent.jar in the /packages/osgidm/ directory of the RM installation, running on the target OSGI device. You install and start it on the device from the RM devices tree - it is automatically activated if the OS Command Support check box from the Optional RM Features table is checked at device registration.

For example:

target.executeLegacy("getfile -timestamp \"d:\\upload\\file.txt\" \"c:\\devices\" ")