Deploy a cron job with flags
A cron job is a container that runs to completion on a schedule, then exits. Use it for nightly batches, periodic cleanups, hourly imports — anything that runs on a clock instead of continuously.
A cron job is a container that runs to completion on a schedule, then exits. Use it for nightly batches, periodic cleanups, hourly imports — anything that runs on a clock instead of continuously.
For the YAML-mode equivalent, see Deploy a cron job with YAML.
Minimal create
reis container:create \
--type cronjob \
--name "Nightly Reports" \
--handle nightly-reports \
--image ghcr.io/myorg/reports:v1.0.0 \
--schedule "0 2 * * *" \
--regions falkenstein-1--schedule is required for --type=cronjob — Reis refuses to create the job without one.
A more typical deploy
A Laravel artisan command running nightly, with a timezone, retries, and a couple of env vars:
reis container:create \
--type cronjob \
--name "Nightly Reports" \
--handle nightly-reports \
--image ghcr.io/myorg/reports:v1.0.0 \
--project my-project \
--schedule "0 2 * * *" \
--tz Europe/London \
--concurrency Forbid \
--backoff_limit 3 \
--cpu 100 \
--memory 256 \
--regions falkenstein-1 \
--env REPORT_BUCKET=prod-reports \
--secrets S3_KEY=s3-key \
--command /usr/bin/php \
--args artisan --args reports:nightly --args --send-emailFlag reference (cronjob-specific)
| Flag | Description |
|---|---|
--type cronjob | Selects the cron job type (required) |
--schedule | 5-field cron expression (required) |
--tz | IANA timezone (default UTC) |
--concurrency | Allow, Forbid (default), or Replace |
--suspended / --no-suspended | Pause scheduling without deleting |
--backoff_limit | Max retry attempts per execution (default 3) |
--active_deadline | Hard wall-clock cap per execution in seconds |
--ttl_seconds | Garbage-collect finished run records after N seconds (default 3600) |
--starting_deadline | Skip a run if more than N seconds late |
--successful_history | How many successful runs to keep (default 3) |
--failed_history | How many failed runs to keep (default 3) |
--command | ENTRYPOINT token — repeatable |
--args | CMD token — repeatable |
Standard sizing, env/secret, and region flags from HTTP containers also apply.
Cron jobs ignore: --port, --healthcheck, scaling flags, every networking / security flag, and Prometheus metrics.
Concurrency policy in plain words
| Flag value | What happens if tick T's run is still going when T+1 fires |
|---|---|
Allow | New run starts alongside the old one |
Forbid | New tick is skipped — wait for the next one |
Replace | Old run is killed, new one starts fresh |
Pausing, resuming, and triggering ad-hoc runs
# Pause scheduling without deleting
reis container:update nightly-reports --suspended
# (or equivalently)
reis container:suspend nightly-reports
# Resume
reis container:resume nightly-reports
# Trigger a manual run outside the schedule
reis container:run nightly-reports
# List recent runs
reis container:runs nightly-reports
# Tail the logs of a specific run
reis container:run-logs nightly-reports <job-name-from-runs-output>Updating a cron job
# Change the schedule
reis container:update nightly-reports --schedule "0 4 * * *"
# Adjust retries
reis container:update nightly-reports --backoff_limit 5
# Bump the image
reis container:update nightly-reports --image ghcr.io/myorg/reports:v1.1.0Related
- Deploy a cron job with YAML — declarative version
- Deploy a worker with flags — for continuous background work
- Flag mode overview — repeatable flags, booleans, short aliases