# NOT RUN {
library(pbdRPC, quietly = TRUE)
rpcopt_set(user = "snoweye", hostname = "192.168.56.101")
### Check an R session.
cmd <- "Rscript -e 'sessionInfo()'"
### For Linux, Mac OSX, Solaris.
rpc(cmd = cmd, exec.type = "ssh")
### For Windows.
rpc(cmd = cmd, exec.type = "plink")
### Manually
args <- "snoweye@192.168.56.101 Rscript -e 'sessionInfo()'"
ssh(args) # Note ssh uses "-p" for server port.
plink(args) # Note plink uses "-P" for server port.
### Manually launch a remoter server at background.
user.hostname <- "snoweye@192.168.56.101"
preload <- "source ./work-my/00_devel_R"
rr <- "nohup Rscript -e 'remoter::server()' > .rrlog 2>&1 < /dev/null &"
args <- paste(user.hostname, " \"", preload, "; ", rr, "\"", sep = "")
plink(args)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab