Skip to Content
CLI & APICommand reference

stackblaze cron

List the app's scheduled tasks

Usage: stackblaze cron [options] [command]

List the app's scheduled tasks

Options:
  --api-url <url>             StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>             API token, sb_pat_... (env STACKBLAZE_TOKEN)
  -p, --project <name>        Project name
  -e, --env <name>            Environment name (default: production)
  -a, --app <name>            App name
  --json                      Output JSON (same as -o json) (default: false)
  -o, --output <format>       Output format: text or json (choices: "text",
                              "json")
  -h, --help                  Print help

Commands:
  list|ls [options]           List scheduled tasks with their schedule, command
                              and last run
  run [options] <name>        Run a scheduled task now (one-off run)
  logs [options] <name>       Logs of a scheduled task's runs (-f to follow
                              live)
  set [options] <name>        Create or update a scheduled task (one release)
  delete|rm [options] <name>  Remove a scheduled task

cron list

Usage: stackblaze cron list|ls [options]

List scheduled tasks with their schedule, command and last run

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  -p, --project <name>   Project name
  -e, --env <name>       Environment name (default: production)
  -a, --app <name>       App name
  --json                 Output JSON (same as -o json) (default: false)
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Example

List an app's scheduled tasks with their schedule, last run and command.

stackblaze cron list -p github-demo-gv35 -e dev -a nginx
OK github-demo-gv35/dev/nginx-9agm scheduled tasks
  NAME   SCHEDULE      LAST RUN              COMMAND
  hello  */30 * * * *  succeeded             /bin/sh -c 'echo hello from nginx; nginx -v'  (managed by scheduled-tasks-31d7)

cron run

Usage: stackblaze cron run [options] <name>

Run a scheduled task now (one-off run)

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  -p, --project <name>   Project name
  -e, --env <name>       Environment name (default: production)
  -a, --app <name>       App name
  --json                 Output JSON (same as -o json) (default: false)
  --wait                 Wait until the run finishes (exit 1 if it fails)
                         (default: false)
  --timeout <seconds>    Max --wait time (default: 3600)
  --ci                   Output NDJSON events (default: false)
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Example

Run a scheduled task now, outside its schedule, and wait for it to finish. With --wait the command exits with 1 if the run fails.

stackblaze cron run nightly-report --wait -p github-demo-cw8z -e dev -a hello-web
nightly-report was just saved and is still rolling out — retrying…
Started nightly-report (run hello-web-qw6y-nightly-report-mmww8ro2s) — waiting for it to finish…
run hello-web-qw6y-nightly-report-mmww8ro2s → running
run hello-web-qw6y-nightly-report-mmww8ro2s → succeeded
OK nightly-report succeeded (run hello-web-qw6y-nightly-report-mmww8ro2s)

cron logs

Usage: stackblaze cron logs [options] <name>

Logs of a scheduled task's runs (-f to follow live)

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  -p, --project <name>   Project name
  -e, --env <name>       Environment name (default: production)
  -a, --app <name>       App name
  --json                 Output JSON (same as -o json) (default: false)
  -f, --follow           Follow live until Ctrl-C (--json: NDJSON) (default:
                         false)
  --job <run>            Only this run (a name from `cron list --json` / `cron
                         run`)
  -n, --limit <n>        Newest N lines
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Example

Show the output of a scheduled task's runs. Add -f to follow a run live, or --job <run> for one run.

stackblaze cron logs nightly-report -p github-demo-cw8z -e dev -a hello-web
2026-11-25T14:51:31.415Z report for 2026-11-25
2026-11-25T14:51:31.417Z nginx version: nginx/1.27.3

cron set

Usage: stackblaze cron set [options] <name>

Create or update a scheduled task (one release)

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  -p, --project <name>   Project name
  -e, --env <name>       Environment name (default: production)
  -a, --app <name>       App name
  --json                 Output JSON (same as -o json) (default: false)
  --schedule <cron>      5-field cron expression, e.g. "0 2 * * *" (UTC), or
                         @hourly / @daily
  --command <cmd>        Command to run in the app image (no shell: use sh -c
                         '…' for pipes)
  --image <image>        Run this image instead of the app's
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Examples:
  stackblaze cron set cleanup --schedule "0 3 * * *" --command "node scripts/cleanup.js"
  stackblaze cron set report --schedule "@hourly" --command "sh -c 'npm run report | tee /tmp/r'"
  stackblaze cron set cleanup --schedule "30 3 * * *"   # change the schedule only

Example

Create a scheduled task that runs every night at 02:00 UTC in the app's image. Use sh -c '…' when the command needs a shell.

stackblaze cron set nightly-report --schedule "0 2 * * *" \
  --command "sh -c 'echo report for \$(date -u +%F); nginx -v'" \
  -p github-demo-cw8z -e dev -a hello-web
OK Created nightly-report: 0 2 * * *  sh -c 'echo report for $(date -u +%F); nginx -v'

Run it again with only --schedule or only --command to change just that.

cron delete

Usage: stackblaze cron delete|rm [options] <name>

Remove a scheduled task

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  -p, --project <name>   Project name
  -e, --env <name>       Environment name (default: production)
  -a, --app <name>       App name
  --json                 Output JSON (same as -o json) (default: false)
  -y, --yes              Skip the confirmation prompt (default: false)
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Example

Remove a scheduled task. Type the task name to confirm, or pass -y.

stackblaze cron delete nightly-report -p github-demo-cw8z -e dev -a hello-web
!  This removes the scheduled task nightly-report from github-demo-cw8z/dev/hello-web-qw6y.
Type the task name to confirm: nightly-report
OK Removed scheduled task nightly-report

On this page