Skip to content

floraison/qron

Repository files navigation

qron

tests Gem Version

Queue and cron.

A stupid Ruby cron thread that wakes up from time to time to perform according to what's written in a crontab.

Given etc/qrontab_dev:

@reboot       p [ :hello, "just started" ]
* * * * *     p [ :hello, :min, Time.now ]
* * * * * *   p [ :hello, :sec, Time.now ]

and

require 'qron'

q = Qron.new(tab: 'etc/qrontab_dev')
q.join
[:hello, :sec, 2025-03-23 15:39:56.558783631 +0900]
[:hello, :sec, 2025-03-23 15:39:57.368985197 +0900]
[:hello, :sec, 2025-03-23 15:39:58.308865845 +0900]
[:hello, :sec, 2025-03-23 15:39:59.209102149 +0900]
[:hello, :min, 2025-03-23 15:40:00.149162785 +0900]
[:hello, :sec, 2025-03-23 15:40:00.149290935 +0900]
[:hello, :sec, 2025-03-23 15:40:01.039228675 +0900]
(...)

Uses fugit for cron parsing and stagnum as its worker pool.

A little brother to rufus-scheduler.

Timezones

It's OK to use timezones in the qrontab file:

30 * * * *     Asia/Tokyo        p [ :tokyo, :min, Time.now ]
30 4 1,15 * 5  Europe/Budapest   p [ :budapest, :min, Time.now ]

LICENSE

MIT, see LICENSE.txt

Releases

No releases published

Packages

No packages published