RPushbullet不适用于预定任务

时间:2019-08-02 13:51:22

标签: r notifications schedule

我正在使用RPushbullet软件包来通知我脚本运行完毕。这真的很好。现在,我有一些脚本希望通过Windows Scheduler定期运行。我找到了一种通过Windows调度程序执行此操作的方法,如下所述: https://datasciencediving.wordpress.com/2017/10/17/2039/ 当我没有通知时,这也有效。当我在代码中包括RPushbullet行时,该脚本在R中运行良好,但在计划时却不行(我正在使用Windows7)。

为了获得有关该问题的更多信息,我从命令行运行了脚本。我以为问题可能出在我的代理没有正确传递蜂鸣或类似的问题上,所以我用下面的简单脚本对此进行了测试:

# file = test.R
library(dplyr)
library(rvest)
library(XML)
library(RPushbullet)
library(curl)
library(httr)

Sys.setenv(http_proxy = "MyProxy:MyPort")
fn <- "MyPath\\TestFile.txt"

#test I can access internet and write to file
MapAd <- "http://ftp.ebi.ac.uk/pub/databases/chembl/SureChEMBL/data/map/"
webpage <- MapAd %>% read_html() %>% htmlParse()
t1Links <- data.frame(xpathSApply(webpage, '//a', xmlGetAttr, 'href'),stringsAsFactors=F)
write(t1Links[1,1], file=fn, append=T) # this gets written into file - to here works

# send pb
pbPost("note", "Testing", "Here a message",apikey ="XXXX") # this line is only successful running the script 'manually' in R, but not when using the scheduler or through the command line

然后我使用

在命令行中运行代码
Rscript -e "source('MyPath/test.R')"

我在命令行中收到的错误消息如下: Error in curl::curl_fetch_memory(pburl, handle = h) : Timeout was reached: Connection timed out after 10000 milliseconds Ruft auf: source ... pbPost --> lapply --> FUN .createPush --> <Annonymous> Ausfuehrung angehalten.

如何使Pushbullet通知适用于计划任务?

0 个答案:

没有答案