[R] R in Batch mode

Bos, Roger roger.bos at rothschild.com
Thu Jul 14 13:39:40 CEST 2011

Duncan's suggestion is probably the way to go, but I will just point out
that R does have a facility to perform a task when an error occurs.  I
have my code set up to send me an email when my batch code fails.
(email() is a function I wrote that executes sql command to send email
via dbmail.)

.Err <- function() {email("roger.bos at rothschild.com","!Notify: Job
FAILED on " %+% Sys.info()[4],"","TEXT","HIGH")}
options (error = .Err)



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Duncan Murdoch
Sent: Wednesday, July 13, 2011 5:04 PM
To: cornejotux at gmail.com
Cc: r-help at r-project.org
Subject: Re: [R] R in Batch mode

On 11-07-13 4:15 PM, Jorge Cornejo wrote:
> Hi, I'm running long code in Batch mode (as a process in ubuntu using 
> $nohup R CMD BATCH MyCode.R out.out&), but every one in a while it 
> fail and the process stops.
> When the code finish with no problems, it sends an e-mail, but if 
> fails, I'm not aware unless I check the working process, and I cannot 
> be checking the process all day!.
> Is there any way to send me a warning when the process stops/fails?

This is really an Ubuntu question, isn't it?

I'd suggest writing a script which calls your R batch file.  The last
thing the batch file should do is write some sort of status value.  The
last thing the script should do is check and act on the status.

Of course, if whatever kills your batch file kills the script too,
you're out of luck.

Duncan Murdoch

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

This message is for the named person's use only. It may\...{{dropped:20}}

More information about the R-help mailing list