0

I am trying to run an R script from the terminal on an EC2 AWS Instance.

I run the following: nohup R Rfiles/MyRscript.R

With the terminal command line:

rstudio@ip-10-0-0-8:~/Dropbox/Folder$ nohup R Rfiles/MyRscript.R

My nohup.out file says:

ARGUMENT 'Rfiles/MyRscript.R' __ignored__

Fatal error: you must specify '--save', '--no-save' or '--vanilla'

I tried adding --save etc. without any progress so I assume I am going wrong with trying to call the R script using nohup.

My question is how can I run correctly the R script using nohup so that I can leave it running and log out.

EDIT:

I tried this but got the error: ignoring input and appending output to 'nohup.out'

nohup R CMD BATCH ./Rscript.R &

EDIT 2:

This seems to be working, however I am not exactly sure what I am creating/done

nohup R CMD BATCH ./MYR_SCRIPT.R </dev/null >nohup.out 2>nohup.err
user113156
  • 6,761
  • 5
  • 35
  • 81

1 Answers1

0

the syntax for this would be

R CMD BATCH [options] infile [outfile] &

or

nohup R CMD BATCH ./myprog.R &

but as you stated you already tried this.

The following has some useful information: Running R in the background along with this https://stat.ethz.ch/R-manual/R-devel/library/utils/html/BATCH.html

are you perhaps adding the arguments in the wrong place?

nohup R CMD BATCH --save ./myprog.R &
  • Thanks, this seems to be working for me `nohup R CMD BATCH ./R_scripts_location/MYR_Script.R nohup_RScript.out 2>nohup_RScript.err &` – user113156 May 07 '19 at 15:43