1

I am using taskscheduleR to run my R code. The one I have to run ONCE works just fine, however none of the other ones (HOURLY, WEEKLY, DAILY, etc.) work despite that R reports "SUCCESS: The scheduled task "test2" has successfully been created."

Here is the code I used to run ONCE (works fine):

library(taskscheduleR)
myscript <- 'C:\\Users\\....\\File.R'
taskscheduler_create(taskname = "test1", rscript = myscript,
                     schedule = "ONCE", starttime = format(Sys.time() + 
62, "%H:%M"))

Here is the code I used to run WEEKLY(does not work):

library(taskscheduleR)
myscript <- 'C:\\Users\\....\\File.R'
taskscheduler_create(taskname = "test3", rscript = myscript,
                      schedule = "WEEKLY", starttime = "09:00", days = 
"THU")

There is no log generated in this case and it looks like task was never scheduled.

similar for the HOURLY (does not work): library(taskscheduleR) myscript <- 'C:\Users\....\File.R' taskscheduler_create(taskname = "test2", rscript = myscript, schedule = "DAILY", starttime = "09:10") There is no log generated in this case and it looks like task was never scheduled.

TylerH
  • 20,799
  • 66
  • 75
  • 101
TTT
  • 83
  • 1
  • 6

1 Answers1

1

Use the startdate argument indicating when this schedule should start working. The default of that is startdate = format(Sys.Date(), "%d/%m/%Y"). So I see you posted this on February 9. That would be 09/02/2018. But note that this depends on your locale. If you are in the US and you have a default locale, that means, start from the 2nd of September instead of the 9th of February. If you are in Belgium, 09/02/2018 means, start on the 9th of February.

So change the startdate argument according to your locale, e.g. startdate = format(Sys.Date(), "%m/%d/%Y")

  • taskscheduler_create(taskname = "test4", rscript = myscript, schedule = "HOURLY", startdate = format(Sys.Date(), "%m/%d/%Y"), starttime = "10:27") - this worked well, thank you! – TTT Feb 15 '18 at 06:47