---
title: Jobs And One-Off Commands
url: "/docs/apps/jobs/"
canonical_url: https://docs.blossom88.com/docs/apps/jobs/
markdown_url: https://docs.blossom88.com/docs/apps/jobs.md
summary: Run commands on a schedule or once, alongside your Services
---

# Jobs And One-Off Commands

A Job is a saved command in an Environment, such as a nightly report or a
cleanup task. Run it on demand or on a schedule. Each run starts a fresh
Container from your App's current release, with its code and variables, so
it never disturbs the Containers serving your users. Ask your agent:

> Run the cleanup task every night at 2 AM.

## Save A Job

    blossom job:init

job.yml:

```yaml
job:
  environment_id: environment-100
  name: maintenance
  command: bin/rails maintenance:cleanup
  # timeout_seconds: 120 # default 900, up to 3600
  schedule:
    enabled: false
    cron: "0 2 * * *"
    time_zone: Etc/UTC
    overlap_policy: skip
```

    blossom job:create --data job.yml
    blossom job:run:create --job job-100 --follow

Saving a Job never runs it. **Run now** on the Job's page, or
`job:run:create`, starts a run.

## Schedule It

Set `schedule.enabled: true`. Cron has five fields: minute, hour, day of
month, month and weekday. Use an IANA time zone such as `America/New_York`
for local time. `job:show` and the Job's page show the next run. If a run is
still going when the next one is due, the new one is skipped and recorded.

## Run A Command Once

For a one-off, such as a report or a data fix, run the command directly. It
uses the same release and variables, without saving a Job or deploying:

    blossom job:run:create --environment environment-100 --command "bin/rails reports:generate" --follow

## Follow And Manage Runs

    blossom job:run:list --job job-100
    blossom job:run:logs --id job_run-100 --follow
    blossom job:run:cancel --id job_run-100

Each run keeps its command, release, output and result, even after the Job
changes or is deleted.

## What You Get

- Scheduled and one-off commands without a separate worker to run
- Each run sized to match your App's largest Service, unless you choose a size
- Full output and history for every run, live as it runs
