[R-sig-Debian] running R in batch mode on Ubuntu

Michael Rutter mar36 at psu.edu
Fri Aug 16 20:13:16 CEST 2013



On 08/16/2013 12:50 PM, Dirk Eddelbuettel wrote:
>
> On 16 August 2013 at 12:45, Elizabeth Tighe wrote:
> |
> | So, I'm submitting R 3.0.1 jobs on Ubuntu (13.04) using 'R CMD BATCH
> | --no-save filename.R &'  (have an alias set to subr='R CMD BATCH --no-save")
> |
> | and am having a problem of sometimes the process ending without the R
> | commands contained in the batch file actually having finished running.
> |
> | We're running Bayesian models using R2jags jags.parallel and it ends
> | during the jags run, so it might be something funky with that package,
> | but am curious to know if the general issue of R process ending
> | unceremoniously is anything anyone has run into.
>
> Use either littler ("sudo apt-get install littler") which we wrote for
> this purpose, or else use Rscript (which came a little later, but now comes
> with R).
>
> There are also packages for parsing command-line arguments, so you can really
> create scripts '#!/usr/bin/r' with all the glory.
>
> Dirk
>

Liz,

Another alternative would be to use "screen" or one of its alternatives, 
"Byobu" or "tmux".  These are what are called terminal multiplexers.  It 
allows you to start a process, logout will killing the process, then log 
in later from the same location or different location.

You can start you R script without the "&", and then detach the 
terminal.  Not exit, but detach using a specific key sequence like 
Ctrl-A d.  You can then log back in (reattach) to the terminal and see 
if it is still running or if it failed, what the output is.  If you do a 
google search for "screen tutorial linux", you will find some good 
information.  I often use this when I am running a long process on a 
server and am too lazy to write a proper script :)

Michael

-- 
Dr. Michael A. Rutter
Associate Professor of Statistics
Program Coordinator, Mathematics
Penn State Erie, The Behrend College
Station Road
Erie, PA 16563
http://math.bd.psu.edu/faculty/rutter



More information about the R-SIG-Debian mailing list