Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pause taskscheduleR at night

I have a R program to execute every 2 hours at day time, say between 8:30-18:30. It seems like everything works except there is no option to pause from 18:30 to 8:30 next morning. Please help! Thanks. The code I used to successfully execute every 2 hours is as follows.

 library(taskscheduleR)
 taskscheduler_create(taskname = "code_hr", rscript = 
 "C:/Users/me/Documents/code.R",schedule = "HOURLY", starttime = "08:30", 
 modifier = 2, startdate = format(as.Date("2017-08-14"), "%m/%d/%Y"))
like image 219
xyx Avatar asked Oct 15 '25 18:10

xyx


1 Answers

Using taskscheduleR often requires a little editing in Windows Task Scheduler to add more advanced options such as this.

As the first step I typically create the task as best I can with taskscheduleR, like you did. This helps you to get several R-related settings correct.

For the 2nd step do the following:

  1. Click Start
  2. Search for "schedule tasks" and click the corresponding icon to open the Task Scheduler
  3. Click Library
  4. Find and open (edit) your task
  5. Click Triggers
  6. Click edit
  7. Make sure the task is set to run daily
  8. Look at the Advanced options (below) and set it to run every 2 hours with a duration of 10 hours (beginning at 08:30)

There's a nice screenshot on a related Super User thread: https://superuser.com/questions/345319/how-to-schedule-a-windows-task-to-repeat-every-day-within-a-time-range

like image 130
Hack-R Avatar answered Oct 17 '25 08:10

Hack-R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!