Skip to content

bmmcginty/crdo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CRDO

A cron tool written in crystal. Inspired by this HN comment.

Usage

Make a .crdo.yml file in your home directory. See sample.crdo.yml for an example.

crystal build crdo.cr
./crdo

Notes

I have explicitly chosen not to track the state of dependent tasks across restarts. After a restart, all parent tasks must run once before their child tasks are eligible to run again. If this tool handled reloading of dependent statuses, the load/save functionality would immediately gain complexity, and saved state would cause a causal link between (possibly) changed dependent values in the scheduling file.

Todo

  • on hup or ^c, allow killing running tasks after a configurable timeout
  • Ensure that a task does not run more than once in an assigned time period (other than retry-after-error)
  • specs
  • time zones (Time.local+x.days and Time.local.shift(days: x) give different results, the ladder of these ending up in a never-ending loop)
  • delayed randomized start
  • time window (instead of the current when key)
  • retry period (retry-after-error)
  • job timeout

Maybe

  • parent and group should actually be lists
  • use sudo to run as a different user

Done

  • use --now to avoid writing task state for one-off runs
  • reparse and reload config on sighup
  • import and export (so we don't always run everything on startup)
  • job dependencies
  • job anti-dependencies

How It Works

Crdo runs in a loop. The loop waits for the sooner of:

  • a task finishing
  • a timeout occuring because of a task needing to start Crdo then checks through all tasks and starts any tasks that are startable.

About

Write intuitive cron-like tasks in yaml.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published