exec: Execute a program on all nodes in a node set

The "exec" command allows the experimenter to start a program on all nodes in the respective node set.

The addApplication command enables you to install an application on a node.

Syntax

exec(cmdName, args = nil, env = nil, &block)

where:

  • cmdName - the name of the executable. It should be a path if it is not in the resource controller's search path.
  • args - an optional array of arguments. If an argument starts with a '%', each node will replace placeholders, such as %x, %y, or %n with the respective local values.
  • env - an optional Hash of environment variables and their repsective values which will be set before the command is executed. Again, '%' substitution will occur on the values.
  • block = an optional block with arity 4, which will be called whenever a message is receive from a node executing this command. The arguments of the block are 'node, operation, eventName, message'.

Usage

1 node.exec('route', ['add', '224.0.0.10', 'dev', 'wlan0'])