From c6257879244f80a1822fd5e2e364a773c9c9e887 Mon Sep 17 00:00:00 2001 From: Jan Wijffels Date: Thu, 10 Mar 2022 09:31:40 +0100 Subject: [PATCH] issue #88 schedule once in the future --- DESCRIPTION | 2 +- R/taskscheduleR.R | 10 ++++++++-- inst/NEWS | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e74c32c..1b5070d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,7 @@ Description: Schedule R scripts/processes with the Windows task scheduler. This Authors@R: c(person("Jan", "Wijffels", role = c("aut", "cre", "cph"), email = "jwijffels@bnosac.be"), person("BNOSAC", role = "cph"), person("Oliver", "Belmans", role = c("cph", "aut"))) Maintainer: Jan Wijffels License: AGPL-3 -Version: 1.5 +Version: 1.6 URL: https://github.com/bnosac/taskscheduleR OS_type: windows Imports: diff --git a/R/taskscheduleR.R b/R/taskscheduleR.R index a2195cb..0f6b1e8 100644 --- a/R/taskscheduleR.R +++ b/R/taskscheduleR.R @@ -160,8 +160,14 @@ taskscheduler_create <- function(taskname = basename(rscript), if(!schedule %in% c('ONLOGON', 'ONIDLE')){ cmd <- sprintf("%s /ST %s", cmd, starttime) } - if(!schedule %in% c('ONCE', 'ONLOGON', 'ONIDLE')){ - cmd <- sprintf("%s /SD %s", cmd, shQuote(startdate)) + if(!schedule %in% c('ONLOGON', 'ONIDLE')){ + if(schedule %in% "ONCE" && missing(startdate)){ + ## run once now + cmd <- cmd + }else{ + cmd <- sprintf("%s /SD %s", cmd, shQuote(startdate)) + } + } if(schedule %in% c('WEEKLY', 'MONTHLY')){ cmd <- sprintf("%s /D %s", cmd, days) diff --git a/inst/NEWS b/inst/NEWS index 302ac45..cae5eb6 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,6 +1,9 @@ Package: taskscheduleR ================ +Version: 1.6 [2022-03-10] +- Use startdate in case of schedule = 'ONCE' in order to allow scheduling a script to run once in the future (issue #88) + Version: 1.5 [2021-04-16] - Add rmarkdown to Suggests in DESCRIPTION