每分钟安排一个 Rscript crontab

编程入门 行业动态 更新时间:2024-10-25 22:27:24
本文介绍了每分钟安排一个 Rscript crontab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

出于某种原因,我的 R 脚本无法使用 crontab 运行.我现在每分钟都有它用于测试,但一旦它起作用就会改变它.

For some reason my R script will not run with a crontab. I have it for every minute right now for testing, but will change it once it works.

有什么想法吗?

* * * * * Rscript "/Users/Home/Desktop/David Studios/Scraper/compiler.R"

此外,这只是终端中的普通命令.

Also, this was working as just a normal command in Terminal.

推荐答案

我可以看到可怕的smart在您的 cron 条目中引用.当您从文字处理器复制粘贴时,经常会发生这种情况.在那些令人憎恶的地方退格并重新输入正常的引号.更改:

I can see the dreaded smart quotes in your cron entry. This often happens when you copy-paste from word processors. Backspace over those abominations and re-type normal quotes. Change:

* * * * * Rscript "/Users/Home/Desktop/David Studios/Scraper/compiler.R"

* * * * * Rscript "/Users/Home/Desktop/David Studios/Scraper/compiler.R"

看到区别了吗?它很微妙,很容易被错过.

See the difference? It's subtle and easy to miss.

我看到您已经进行了上述更改,但它仍然不适合您.验证 Rscript 是否在拥有此 crontab 的用户的 $PATH 环境变量中.或者,您可以直接在 cron 条目中指定 Rscript 的完全限定路径.您可以使用以下命令在命令行上快速找到:

I see you've made the above change and it's still not working for you. Verify that Rscript is in the $PATH environment variable for the user that owns this crontab. Alternatively, you can simply specify the fully qualified path to Rscript directly in the cron entry. You can find that quickly on the command line with the following command:

which Rscript

更新 #2:

我从您的评论中看到 Rscript 的完全限定路径是 /usr/local/bin/Rscript.我猜 /usr/local/bin 不在拥有此 crontab 的用户的路径中.尝试使用完全限定的路径,如下所示:

Update #2:

I see by your comments that the fully qualified path to Rscript is /usr/local/bin/Rscript. I'm guessing /usr/local/bin is not in the path for the user who owns this crontab. Try using the fully qualified path, like this:

* * * * * /usr/local/bin/Rscript "/Users/Home/Desktop/David Studios/Scraper/compiler.R"

更多推荐

每分钟安排一个 Rscript crontab

本文发布于:2023-06-07 15:26:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/568592.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:每分钟   Rscript   crontab

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!