My R script works as intended when I run it on its own, but when I try to run it as a cron job, it keeps failing saying
Error: RStudio not running
Execution halted
This is the log file for the cron job.
Loading required package: methods
Attaching package: ‘lubridate’
The following object is masked from ‘package:base’:
date
Linkging to ImageMagick 6.8.9.9
Enabled features: cairo, fontconfig, freetype, fftw, lcms, pango, rsvg, x11
Disabled features: ghostscript, webp
Loading required package: bitops
Attaching package: ‘gmailr’
The following object is masked from ‘package:lubridate’:
date
The following object is masked from ‘package:utils’:
history
The following objects are masked from ‘package:base’:
body, date, labels, message
Error: RStudio not running
Execution halted```
This is my cron job set up
## cronR job
## id: job_3284804a12afb8b01664417646b9fc7f
## tags:
## desc: I execute things
0-59 * * * * /usr/lib/R/bin/Rscript '/home/rstudio/dev/082017_email/weekly_email.R' >> '/home/rstudio/dev/082017_email/weekly_email.log' 2>&1
```