[R] R in cron job: X problems

Liaw, Andy andy_liaw at merck.com
Fri Apr 20 03:12:33 CEST 2007

This is in the FAQ, if I remember correctly...  However, alternatively:

As Jeff Horner recently pointed out on the list, the Cairo package is a
good way of generating png without needing an X display.  You may want
to look into that.  I've just installed cairo on our CentOS boxes and
the Cairo package from CRAN.


From: Mark Liberman
> I'd like to use an R CMD BATCH script as part of a chron job 
> that is set up to run every hour.
> The trouble is that the script creates a graphical output in 
> a file via png(), and apparently this in turn works through X.
> When cron invokes the job, no X server is available -- I 
> suppose that the DISPLAY variable is not set -- and so R 
> exits with an error message in the output file. (If I run the 
> same script in an environment where an X server is properly 
> available, it works as I want it to.)
> I tried setting DISPLAY to thecomputername:0.0 (where 
> "thecomputername"
> is the X.Y.Z form of the computer's name as names it for ssh 
> etc.), but that didn't work.
> Any advice about how to persuade the graphics subsystem to 
> bypass X, or how to set DISPLAY in a safe way to run in a cron job?
> This is a linux system (a recent RedHat server system) with R 2.2.1.
>     Thanks,
>     Mark Liberman
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Notice:  This e-mail message, together with any attachments,...{{dropped}}

More information about the R-help mailing list