bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
331 stars 72 forks source link

I get this error `status 16389` when I use addin to schedule a task. #61

Closed JiaxiangBU closed 5 years ago

JiaxiangBU commented 5 years ago

I get this error status 16389 when I use addin to schedule a task.

Creating task schedule: schtasks /Create /TN "test1.R" /TR "cmd /c C:/PROGRA~1/R/R-35~1.1/bin/Rscript.exe \"C:/Users/lijiaxiang/Documents/R/win-library/3.5/taskscheduleR/extdata/test1.R\"  >> \"C:/Users/lijiaxiang/Documents/R/win-library/3.5/taskscheduleR/extdata/test1.log\" 2>&1" /SC MINUTE /ST 12:44 /SD "28/12/2018" 
Warning in system(cmd, intern = TRUE) :
  running command 'schtasks /Create /TN "test1.R" /TR "cmd /c C:/PROGRA~1/R/R-35~1.1/bin/Rscript.exe \"C:/Users/lijiaxiang/Documents/R/win-library/3.5/taskscheduleR/extdata/test1.R\"  >> \"C:/Users/lijiaxiang/Documents/R/win-library/3.5/taskscheduleR/extdata/test1.log\" 2>&1" /SC MINUTE /ST 12:44 /SD "28/12/2018" ' had status 16389
Error: User cancel
JiaxiangBU commented 5 years ago

Refer this code, I find it works.

library(taskscheduleR)
Jobplanet <- file.path(getwd(),"test1.R")
taskscheduler_create(taskname = "R04_Jobpnanet_Review_Crawling", rscript = Jobplanet, 
                 schedule = "MINUTE", starttime = "12:51", startdate = format(Sys.Date(), "%Y/%m/%d"),
                 days = 31)