soasme / nim-schedules

A Nim scheduler library that lets you kick off jobs at regular intervals.

Home Page:https://soasme.com/nim-schedules/schedules.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Schedule to an specific time

GabrielLasso opened this issue · comments

Hi, I'd like to know if this lib allow me to schedule a task to run everyday at 00:00 UTC, for example.

Or, as a bonus, if it can handle cron expressions (like "0 0 * * *")

I use the following:

let h24Precise = [time-for-the-next-hit-of-24h]
schedules:
  every(id="every24Hours", hours=24, startTime=h24Precise):
    echo("schedules: every24Hours = " & $h24Precise)
commented

@GabrielLasso please use @ThomasTJdev's approach at the moment. I'll spend some time implementing the CRON-style scheduling to the library. Please track #6

@ThomasTJdev @soasme Thanks, that fulfills my needs.

Btw, by reading the documentation I thought that startTime should be used with endTime to create an "interval" in which the job runs

You can close this if you want 😄

commented

@GabrielLasso If you're happy to try the new version (v0.2.0), you can now use cron:

schedules:
  cron(minute="0", hour="0", day_of_month="*", month="*", day_of_week="*", id="every24Hours"):
    echo("Run every day at 00:00")