[R] R in cron job: X problems
Henrik Bengtsson
hb at stat.berkeley.edu
Fri Apr 20 03:11:44 CEST 2007
Try using png2() in R.utils, which immitates png() but uses bitmap()
and ghostscript to create the PNG file. You need to set 'R_GSCMD' to
tell R where ghostscript is located - you can use
System$findGhostscript() at startup to let R try to locate ghostscript
for you.
/H
On 4/19/07, Mark Liberman <myl at cis.upenn.edu> wrote:
> 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.
>
More information about the R-help
mailing list