【问题标题】:cron Job Won't Run on R Scripts on Google Compute Enginecron 作业不会在 Google Compute Engine 上的 R 脚本上运行
【发布时间】:2018-09-02 18:25:39
【问题描述】:

按照这些说明,我在 Google 计算实例上运行了 R-Studio Server:http://code.markedmondson.me/launch-rstudio-server-google-cloud-in-two-lines-r/

当我从这个 RStudio-Server 打开一个终端时,我注意到 man、ps、vi、cron 都不存在。

bash: ps: command not found

我的目标是让一个简单的 cron 作业定期运行 R-Script。 我手动安装了 cron:

sudo apt-get update
sudo apt-get install cron

不过,我无法让 cron 运行此测试:

cmd <- cron_rscript("/home/law9723/now_to_file.R")
cron_add(cmd, frequency = "*/1 * * * *", id = "now_to_file", description = "Write now to file every minute")

-显然很困惑

【问题讨论】:

  • 我了解到您正在尝试通过运行 cron_add 将 R 接口与 Google Compute Engine 一起使用来添加 cron 作业。您收到错误消息吗?如果是这样,您可以在此处发布以获取更多上下文吗?谢谢。
  • 嗨。没有错误信息。我最终使用这些说明启动了一个虚拟机:

标签: cron google-compute-engine rstudio-server


【解决方案1】:

我已经成功使用了 rstudio 插件。一个参考是 http://www.bnosac.be/index.php/blog/51-new-rstudio-add-in-to-schedule-r-scripts.

我也觉得你必须从 cron 开始

sudo cron start

https://cran.r-project.org/web/packages/cronR/README.html

当我像你一样在本地使用 googleComputeEngineR 后第一次进入 GCE 上的 Rstudio 时,我安装了包 shinyFiles、miniUI 和 cronR。然后“在 Linux/Unix 上调度 R 脚本”将出现在加载项列表中。

【讨论】:

    【解决方案2】:

    通过使用这些非常有用的说明,我最终完成了工作:https://yuhuisdatascienceblog.blogspot.ca/2017/07/setting-up-r-studio-server-on-google.html

    对与 cron 相关的所有内容都使用绝对路径名是明智的建议。

    我认为当我使用此命令创建虚拟机时,Rstudio-server 所在的沙箱非常小。因此,没有 vi、man、cron、ps...

    gce_vm(template = "rstudio",
                 name = "my-rstudio",
                 username = "mark", password = "mark1234",
                 predefined_type = "n1-highmem-2")
    

    【讨论】:

      猜你喜欢
      • 2018-05-07
      • 2020-09-03
      • 2017-12-17
      • 2017-11-30
      • 1970-01-01
      • 2017-02-04
      • 2013-01-10
      • 1970-01-01
      相关资源
      最近更新 更多