[R] R in cron job: X problems
myl at cis.upenn.edu
Fri Apr 20 02:27:50 CEST 2007
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.
More information about the R-help