On this page:
crontab*

24 Scheduling🔗

 (require koyo/crontab) package: koyo-lib

This module provides a syntactic form for generating components that schedule tasks using a cron-like syntax. This functionality is based on crontab: cron-like scheduling.

syntax

(crontab*
 [schedule-expr handler-expr] ...+)
 
  schedule-expr : string?
  handler-expr : (-> exact-integer? any)
A variant of crontab that produces a component. See the documentation of crontab for details.

Examples:
> (define-system prod
    [app () (lambda () 'the-app)]
    [cron (app) (lambda (app)
                 (crontab*
                  ["* * * * * *"
                   (lambda (timestamp)
                     (printf "~a: ~a~n" timestamp app))]))])
> (system-start prod-system)

1731602272: the-app

> (sleep 5)

1731602273: the-app

1731602274: the-app

1731602275: the-app

1731602276: the-app

1731602277: the-app

> (system-stop prod-system)