Skip to content

[feature] ability to immediately start an @every job #406

Open
@wsw70

Description

@wsw70

Would it be possible to add an option to start jobs scheduled as @every immediately (and not after the interval)?

The docs mention that

For example, "@every 1h30m10s" would indicate a schedule that activates after 1 hour, 30 minutes, 10 seconds, and then every interval after that.

I believe that there it would be interesting to have the immediate start - for instance, I need to do

googleCalendar()
forecast()
temperature()
c := cron.New()
c.AddFunc("@every 1min", googleCalendar)
c.AddFunc("@every 15min", forecast)
c.AddFunc("@every 12min", temperature)
c.Start()

instead of, say

c := cron.New({intervalRunAtStartup: true})
c.AddFunc("@every 1min", googleCalendar)
c.AddFunc("@every 15min", forecast)
c.AddFunc("@every 12min", temperature)
c.Start()

(see also #396)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions