R/crontab.R

Defines functions crontab

Documented in crontab

#' Crontab
#'
#' This function schedule all web scraping function of this package. If you do
#' not want to use all web scraping functions, you can edit yours crontab and
#' comment the ones you do not want.
#'
#' @export

crontab <- function() {
    x <- try(cronR:::parse_crontab(), silent = TRUE)

    if (class(x) != "try-error") {
        ids <- sapply(x$cronR, function(w) w$id)
    } else {
        ids <- ""
    }
 
    ## superbid ----------------------------------
    if (!("superbid_order" %in% ids)) {
        cronR::cron_add("R -e 'WEBDATA::superbid(\"order\")'",
                        at = "8:30", id = "superbid_order")
    }

    if (!("superbid_collect" %in% ids)) {
        cronR::cron_add("R -e 'WEBDATA::superbid(\"collect\")'",
                        at = "20:30", id = "superbid_collect")
    }
}
Andryas/WEBDATA documentation built on Jan. 2, 2020, 1:31 p.m.