KScript docs
EN

Scheduling tasks

Running the scheduler

CommandWhat it does
kscript schedule workEvery minute, until Ctrl+C.
kscript schedule runThe tasks due this minute, then stop.
kscript schedule run --task feedsOne task now, to try it.
kscript schedule listEach task, when it runs and its next run.
kscript serve --with-worker --with-schedulerBoth inside the server, while you work on a site.

In production, run kscript schedule work as a service next to kscript worker, or add one line to the system's crontab that runs the due tasks each minute:

Shell
* * * * * cd /srv/shop && kscript schedule run >> /var/log/shop-schedule.log 2>&1

Each minute's run loads the schedule file afresh, so a change to it takes effect the next minute without a restart. A task that takes longer than a minute doesn't hold up the next minute's tasks. --file names another schedule file; without it the scheduler looks for schedule.kscript, then routes/schedule.kscript.

Edit this page on GitHub