如何在crontab中运行R脚本 [英] How to run an R script in crontab

查看:116
本文介绍了如何在crontab中运行R脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用crontab -e我已经尝试过:

Using crontab -e I've tried:

* * * * *  Rscript /home/.../file.r
* * * * * /usr/lib/R/bin/Rscript /home/.../file.r
* * * * * /usr/bin/Rscript /home/.../file.r
* * * * * /home/.../foo.sh

其中foo.sh包含:

where foo.sh contains:

sudo R CMD BATCH file.r

仅运行$ ./foo.sh即可。
$ R CMD BATCH file.r起作用。

Just running $ ./foo.sh works. $ R CMD BATCH file.r works.

我在crontab中尝试过的所有方法都没有。有任何想法吗?

Nothing I've tried in crontab works. Any ideas?

推荐答案

您需要在foo.sh中包含完整路径:

You'll need to have the full path in your foo.sh:

sudo R CMD BATCH /home/.../file.r

我还应该补充一点,尽管我将第一个版本设置为特定时间而非 * * * * *

I should also add that the first version worked for me, although I set it to a specific time rather than * * * * *

这篇关于如何在crontab中运行R脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆