Scheduler Library
Download Now!
Size :  7Kb
Level :  beta
Version :  0.9.0
Date :  26-Aug-2009


This library provides a high-level scheduler component to the REBOL language for short-term (a few seconds) and long-term jobs (months) using a simple, almost natural dialect (also called a DSL).

Main features :

  • Simple, yet powerfull dedicated dialect for jobs (no cryptic CRON-like job descriptions)
  • Callback based API
  • Transparently integrates within any View or network application
  • Cross-platform alternative to CRON
  • Can easily run as a standalone application

Scheduler Dialect


Launch a script at a precise date and time :
	at 18:30 do %batch.r
	at 10-Sep-2009/02:00 do %batch.r
Launch a script after a delay :
	in 10 mn do %batch.r
	in 3 hours do %batch.r
Define recurring jobs :
	every minute do %job.r
	every 2 days do %job.r
	every 2 days not sunday at 13:00 do %job.r
	every day not [sat sun] 20 times do %job.r
	every month on #15 not [sat sun] do %job.r
	every [#01 - #07 #21 - #27 sunday] do %job.r
	every 15 mn [08:00 - 08:20 12:00 - 20:00] from 02:30 do %job.r
Action can also be a function call or a remote action using a URL
	in 10 mn do my-function
	in 3 hours do

<...> designates optional parts.
  • Event at a precise point in time
  • <name:> AT time! DO action
  • Event after a delay
  • <name:> IN <n> <unit> DO action
  • Recurring event
  • <name:> EVERY <n> <unit> <allowed> <NOT forbidden> <FROM moment> <AT time> <t TIMES>
    	DO action
    Definitions :
        <name:>: set-word! value for naming the task
        <n>: integer! value for unit multiplying.
        <unit>: any of
        <allowed>: time (00:00:00), calendar day (#dd), weekday (mon|monday),
            month (jan|january), range of time|calendar-days, or block of any
            of theses options.
        <forbidden>: same options as  <allowed>
        <moment>: date! or time! value
        <time>: time! value.
        <t>: integer! value (number of repetition)
        action: file!|url!|block!|function!|word! value to be evaluated when event is fired
Syntactic sugar

Default dialect is parsed in BLOCK! mode. That means that only REBOL values are accepted, but some may want to write calendar dates like: 1st, 2nd,... instead or #1, #2,...

So, a preprocessor has been included requiring tasks to be passed as STRING! values to extend the accepted syntax for the following cases :
        Day of month: 1st, 2nd, 3rd, 4th, 5th...
        Units: 12s, 12mn, 12h, 12d,...
Examples using extended string! syntax:
      scheduler/plan "every 12h"
      scheduler/plan "every month not [1st 2nd 3rd 5th]"
      scheduler/plan "every 15mn not [00:00 - 05:00]"


Just add the following line to your application :

do %scheduler.r
then you can call any of the scheduler's library API like :
scheduler/plan []

Scheduler API

scheduler/plan [specs]
scheduler/plan "specs"

Adds one or more jobs to the scheduler. specs describes jobs using the scheduler dialect describe above. Existing scheduled jobs are not changed

scheduler/plan/new [specs]
scheduler/plan/new "specs"

Clear the current scheduled jobs, then adds one or more jobs to the scheduler. specs describes jobs using the scheduler dialect describe above.

scheduler/delete 'name

Removes the named job from the scheduler.


Provides an adequate global event loop for running the scheduler. This is a blocking call that will only return when all the jobs have been done.


  • v.0.9.0 - 26-Aug-2009
    - First public release.