Learn R Programming

pbdRPC (version 0.1-1)

rpc: Remote Procedure Call

Description

Launch a command via ssh or plink on a (remote) server.

Usage

rpc(cmd = "whoami", exec.type = .pbd_env$RPC.LI$exec.type, args = .pbd_env$RPC.LI$args, pport = .pbd_env$RPC.LI$pport, user = .pbd_env$RPC.LI$user, hostname = .pbd_env$RPC.LI$hostname, priv.key = .pbd_env$RPC.LI$priv.key, priv.key.ppk = .pbd_env$RPC.LI$priv.key.ppk, intern = .pbd_env$RPC.CT$intern, wait = .pbd_env$RPC.CT$wait)

Arguments

cmd
the command to be executed on the server.
exec.type
either "ssh" or "plink" in character. Windows will force to use "plink".
args
further arguments to "ssh" or "plink" for connecting to the server in addition to port, user id, and host name.
pport
ssh port opened on the server.
user
user id for logging to the server.
hostname
the server ip or host name.
priv.key, priv.key.ppk
location of the private key for user authentication, the file will be checked first then -i priv.key will be added to args when the file exists. priv.key.ppk is only used when plink is called.
intern, wait
arguments passed to system() or shell() whereever they are applicable.

Value

Mainly the message received from the command line of server may be returned but may not be captured by R.For example, Windows with plink will not capture the return because currently the authentication is not working. A windows bat file is launched by shell.exec() in an additional cmd.exe window to avoid saving password inside R.

Details

Using either ssh or plink to launch a command on a (remote) server. Authentication is working currently for ssh.

NO further input from stdin is expected. Outputs or errors may not be captured by R.

See Also

start_rr(), check_rr(), kill_rr(), ssh(), and plink().

Examples

Run this code
## Not run: 
# library(pbdRPC, quietly = TRUE)
# rpcopt_set(user = "snoweye", hostname = "192.168.56.101")
# 
# ### see start_rr(), check_rr(), and kill_rr() for more examples.
# rpc()
# rpc("ls")
# rpc("ls ~/work-my")
# rpc("cat ~/work-my/00_set_devel_R")
# 
# ### see ssh(), plink(), and run_args() for lower level examples.
# 
# ### Local port forwarding
# rpc(args = "-N -T -L 55555:localhost:55555")
# start_rr()
# 
# library(remoter)
# client()    # equivalent to client(addr = "192.168.56.101")
# ## End(Not run)

Run the code above in your browser using DataLab