CRON Jobs
Schedule recurring OQL jobs with standard cron expressions. Jobs run server-side inside the namespace sandbox. No external cron server required.
| Verb | Description |
|---|---|
DEFINE CRON "name" ON SCHEDULE "expr" OPEN NEST ... CLOSE NEST | Register a cron job |
LIST CRONS SET ?crons | List all cron jobs in the namespace |
DESCRIBE CRON "name" SET ?def | Get cron definition and last-run info |
DELETE CRON "name" | Remove a cron job |
Define a cron job
The schedule is a standard 5-field cron expression: minute hour day month weekday.
DEFINE CRON "daily-report" ON SCHEDULE "0 8 * * *"
OPEN NEST
QUERY "orders" FROM "shop"
WHERE created_at IS GREATER THAN !NOW
SET ?today
AFTER LENGTH ?today SET ?count
AFTER EMAIL "You have " & ?count & " orders today."
TO "admin@myshop.com"
WITH "Daily order count"
CLOSE NEST
AFTER EMIT "Cron registered"
Every minute
DEFINE CRON "heartbeat" ON SCHEDULE "* * * * *"
OPEN NEST
TIME NOW AS "datetime" SET ?ts
AFTER CACHE ?ts AS "last_heartbeat"
CLOSE NEST
Every Monday at 9am
DEFINE CRON "monday-standup" ON SCHEDULE "0 9 * * 1"
OPEN NEST
NOTIFY "Standup in 5 minutes!" TO "team" WITH "Reminder"
CLOSE NEST
List / Delete
LIST CRONS SET ?crons
AFTER EMIT ?crons
DELETE CRON "daily-report"
AFTER EMIT "Removed"