Execute command remotely

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

Arguments

host

host structure to execute command on

cmd

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

args

a character vector of arguments to command.

stderr

should stderr be returned as well.

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.

Author

Rob Kooper

Examples

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