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.

Updated 23 Jun 20263 min read

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-email

Flag reference (cronjob-specific)

FlagDescription
--type cronjobSelects the cron job type (required)
--schedule5-field cron expression (required)
--tzIANA timezone (default UTC)
--concurrencyAllow, Forbid (default), or Replace
--suspended / --no-suspendedPause scheduling without deleting
--backoff_limitMax retry attempts per execution (default 3)
--active_deadlineHard wall-clock cap per execution in seconds
--ttl_secondsGarbage-collect finished run records after N seconds (default 3600)
--starting_deadlineSkip a run if more than N seconds late
--successful_historyHow many successful runs to keep (default 3)
--failed_historyHow many failed runs to keep (default 3)
--commandENTRYPOINT token — repeatable
--argsCMD 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 valueWhat happens if tick T's run is still going when T+1 fires
AllowNew run starts alongside the old one
ForbidNew tick is skipped — wait for the next one
ReplaceOld 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.0