Skip to content

CLI reference

ry cron

Markdown

Run something of an app on a schedule: call a path (the app is woken) or run a command on its own machine.

ry cron [options] [command]

The app’s schedules: when, what, the next slot and the last run.

ry cron list [options] <app>

Alias: ls.

Example:

ry cron list web

Add a schedule: ry cron add <app> "<expr>" –path /tick, or –command "<shell>" for a machine of its own.

ry cron add [options] <app> <schedule> [command...]

Options:

  • --timezone <zone>: IANA time zone the expression is read in (default UTC), e.g. Europe/Berlin.
  • --path <path>: The app is woken and this path is called, e.g. /api/tick.
  • --method <method>: With –path: GET (default) or POST.
  • --command <shell>: Runs on a machine of its own, as /bin/sh -c '<shell>' (or give the argv after –).
  • -t, --timeout <seconds>: Deadline (–path: per attempt, default 60, at most 240; –command: default 900, at most 3600).
  • -m, --memory <mb>: With –command: memory of its machine in MB (default: the app’s).
  • -c, --vcpus <n>: With –command: vCPUs of its machine (default: the app’s).
  • --paused: Create it paused (ry cron resume starts it).

Example:

ry cron add web "*/15 * * * *" --path /api/tick
ry cron add web "0 3 * * *" --timezone Europe/Berlin --command "npm run cleanup"

From ry cron add --help:

The expression has five fields (minute hour day-of-month month day-of-week) or is @hourly, @daily, ...
Examples:
ry cron add shop "*/15 * * * *" --path /api/tick
ry cron add shop "0 3 * * *" --timezone Europe/Berlin --command "npm run cleanup" --memory 8192
ry cron add shop "@daily" -- node scripts/report.js --full
--path suits frequent, light work: down to every minute, the app does it in its own machine.
--command suits heavy, rare work: at most hourly, every run gets a machine of its own size.
A slot that comes while the previous run of the same schedule still runs is skipped, not queued.
A path is called signed: header Rytiv-Cron-Signature = v1=<hex HMAC-SHA256 of '<Rytiv-Cron-Timestamp>.<path>'>
under the app's secret RYTIV_CRON_SECRET (created with the app's first --path schedule; the app sees it from its next deploy).

Remove a schedule and its run history.

ry cron rm [options] <app> <id>

Alias: remove.

Options:

  • -y, --yes: Confirm without asking (automation).

Example:

ry cron rm web sch-1a2b3c4d --yes

Stop starting runs (the schedule and its run log stay).

ry cron pause [options] <app> <id>

Example:

ry cron pause web sch-1a2b3c4d

Start running again, from the next slot on (nothing paused is caught up).

ry cron resume [options] <app> <id>

Example:

ry cron resume web sch-1a2b3c4d

The newest runs of a schedule: slot, state, attempts, answer, duration, reason.

ry cron runs [options] <app> <id>

Options:

  • -n, --limit <n>: How many (default 20, at most 100).

Example:

ry cron runs web sch-1a2b3c4d

Run a schedule once, now (to try the target without waiting for its slot).

ry cron run [options] <app> <id>

Example:

ry cron run web sch-1a2b3c4d