Scheduled tasks

Scheduled tasks

List, run, follow, create and remove an app's scheduled tasks.

stackblaze cron

The linked app's scheduled tasks. list shows each task with its schedule, command and last run; run starts a one-off run now; logs prints a task's run logs (-f follows them live); set creates or changes a task; delete removes one.

usage
stackblaze cron list
stackblaze cron run <name> [--wait] [--timeout <seconds>] [--ci]
stackblaze cron logs <name> [-f] [--job <run>] [-n <n>]
stackblaze cron set <name> [--schedule <cron>] [--command <cmd>] [--image <image>]
stackblaze cron delete <name> [-y]

set and delete change the app's own tasks in one release, like the dashboard's Scheduled tasks panel. set with only --schedule changes the schedule and keeps the command. Tasks managed by a Scheduled tasks node are listed, run and followed here, but edited on that node.

Schedules are five-field cron expressions in UTC, or @hourly / @daily. --command runs without a shell; use sh -c '…' for pipes.

FlagDescription
--waitrun: wait until the run finishes (exit 1 if it fails)
--timeout <seconds>run: maximum --wait time (default 3600)
--cirun: print NDJSON events
-f, --followlogs: follow live until Ctrl-C (with --json: NDJSON)
--job <run>logs: only this run (a name from cron list --json or cron run)
-n, --limit <n>logs: newest N lines
--schedule <cron>set: five-field cron expression, e.g. "0 2 * * *" (UTC), or @hourly / @daily
--command <cmd>set: command to run in the app image
--image <image>set: run this image instead of the app's
-y, --yesdelete: skip the confirmation prompt

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze cron list
stackblaze cron set cleanup --schedule "0 3 * * *" --command "node scripts/cleanup.js"
stackblaze cron run cleanup --wait          # exit 1 if the run fails
stackblaze cron logs cleanup -f
stackblaze cron set cleanup --schedule "30 3 * * *"   # change the schedule only
stackblaze cron delete cleanup -y