[R] Access to R from a remote location - follow up

Douglas Bates bates at stat.wisc.edu
Fri Jan 10 15:41:02 CET 2003


Martin Maechler <maechler at stat.math.ethz.ch> writes:

> >>>>> "Roger" == Roger Peng <rpeng at stat.ucla.edu>
> >>>>>     on Thu, 9 Jan 2003 14:11:47 -0800 (PST) writes:
> 
>     Roger> This is possible because I've done it many times.
>     Roger> But I think whether or not your job gets killed when
>     Roger> you log out depends on your shell/operating system.
> 
> yes.
> For R on Unix alikes the easiest way probably is
> 
>     R BATCH myscript.R &
> 
> where the final "&" is absolutely crucial and mentioned on the
> help(BATCH) page. 
> Since "R BATCH" does a "--save" automatically and since I never
> work with .RData (but rather with explicit save()s and load()s
> when needed), my "myscript.R" would end with  
> 
>  q("no")

In some shells you may find it works better to use

 nohup R BATCH myscript.R &

so that you can log out without killing background jobs.  (The nohup
command name indicates that the program will not respond to the HUP or
"hangup" signal.)

I agree with Martin that it is a good idea to end such scripts with
 q("no")
if you do not want the workspace saved.  Another variation is to use
the --no-save flag.

 nohup R BATCH myscript.R --no-save &

-- 
Douglas Bates                            bates at stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/




More information about the R-help mailing list