【发布时间】:2015-05-24 16:49:15
【问题描述】:
我想尝试如何从 R markdown 文件呈现 html,但从作为 Cron 作业运行的 bash 脚本呈现。我不知道为什么一切正常,除了作为 Cron 作业运行。我的工作:
我的脚本是来自 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://rmarkdown.rstudio.com>.
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.
这个脚本在 Rstudio 中没有任何问题。
接下来我尝试从终端运行 Rmd 脚本:
Rscript -e "require( 'rmarkdown' ); render('/home/sms/Dokumenty/R/test.Rmd', 'html_document')"
没有任何问题。它有效。
所以我创建了 bash 脚本
#!/bin/bash
Rscript -e "require('rmarkdown'); 渲染('/home/sms/Dokumenty/R/test.Rmd', 'html_document')"
并更改了 chmod 755 test.sh
也像魅力一样工作。
但是当放入 Cron 文件时(管理员和用户):
28 18 * * * sh /home/sms/Dokumenty/R/test.sh
没用
知道我做错了什么吗?
【问题讨论】: