running script (r script) remotely to other comput

2019-03-06 00:47发布

I have small example script (script_p.r) like the following, which in intend run in terminal.

#!/usr/bin/Rscript
sink("output_capture.txt")
mn <- mean(1:10)
# and so on, much longer list of tasks

I want to run this script remotely with other iMac host computer (ip address e.g.. not real : 111.111.111.111) which allows me to log in and work (e.g., not real. username user101, password p12334)

Is this way to run this script remotely (say using ssh), say from other computer with ip address: 222.222.222.222 and user name user102 ?

标签: r macos ssh
1条回答
一纸荒年 Trace。
2楼-- · 2019-03-06 01:28

First, put script_p.r on the remote machine.

Then either just do:

ssh user102@222.222.222.222
user102:-$ ./script_p.r

or ssh user102@222.222.222.222 'script_p.r'

or put it in a script: runremote.sh :

#!/bin/bash
ssh user102@222.222.222.222 'script_p.r'

and run locally

user101:-$ ./runremote.sh
查看更多
登录 后发表回答