ssh_exec | R Documentation |
Run a command or script on the host while streaming stdout and stderr directly to the client.
ssh_exec_wait(
session,
command = "whoami",
std_out = stdout(),
std_err = stderr()
)
ssh_exec_internal(session, command = "whoami", error = TRUE)
session |
ssh connection created with |
command |
The command or script to execute |
std_out |
callback function, filename, or connection object to handle stdout stream |
std_err |
callback function, filename, or connection object to handle stderr stream |
error |
automatically raise an error if the exit status is non-zero |
The ssh_exec_wait()
function is the remote equivalent of the local sys::exec_wait()
.
It runs a command or script on the ssh server and streams stdout and stderr to the client
to a file or connection. When done it returns the exit status for the remotely executed command.
Similarly ssh_exec_internal()
is a small wrapper analogous to sys::exec_internal()
.
It buffers all stdout and stderr output into a raw vector and returns it in a list along with
the exit status. By default this function raises an error if the remote command was unsuccessful.
Other ssh:
scp
,
ssh_connect()
,
ssh_credentials
,
ssh_tunnel()
## Not run:
session <- ssh_connect("dev.opencpu.org")
ssh_exec_wait(session, command = c(
'curl -O https://cran.r-project.org/src/contrib/jsonlite_1.5.tar.gz',
'R CMD check jsonlite_1.5.tar.gz',
'rm -f jsonlite_1.5.tar.gz'
))
ssh_disconnect(session)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.