I want to try rendering html from an R markdown file, but from a bash script that runs as Cron jobs. I don’t know why everything is working fine, except for working in Cron. What am I doing:
My script is a demo of a script from Rstudio
---
title: "test"
author: "sms"
date: "24 maja 2015"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http:
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
summary(cars)
```
etc.
This script works without problems in Rstudio.
Next, I try to run the Rmd script from the terminal:
Rscript -e "require( 'rmarkdown' ); render('/home/sms/Dokumenty/R/test.Rmd', 'html_document')"
There were no problems. He works.
So I am creating a bash script
#!/bin/bash
Rscript -e "require ('rmarkdown'); render ('/home/sms/Dokumenty/R/test.Rmd', 'html_document')"
and modified by chmod 755 test.sh
Also works as charme.
But if you put in the Cron file (admin and user):
28 18 * * * sh /home/sms/Dokumenty/R/test.sh
Does not work
Any idea what I'm doing wrong?
source
share