Execute command remotely

remote.execute.cmd(host, cmd, args = character(), stderr = FALSE)

Arguments

host

host structure to execute command on

args

a character vector of arguments to command.

stderr

should stderr be returned as well.

command

the system command to be invoked, as a character string.

Value

the captured output of the command (both stdout and stderr)

Details

Executes the given command on the remote host using ssh. If the user is set the system will login as the given user. If the host given is the local machine it will execute the command locally without ssh.

Examples

# NOT RUN {
  host <- list(name='geo.bu.edu', user='kooper', tunnel='/tmp/geo.tunnel')
  print(remote.execute.cmd(host, 'ls', c('-l', '/'), stderr=TRUE))
# }