# Run jobs, cron jobs and scheduled URLs

> Three ways to run work that is not a server on BWEZE: a one-off job, a cron job on a schedule, and a scheduled URL, and how each is billed.

Source: https://bweze.com/guides/jobs-and-cron/ · Updated 2026-11-19

Some of an app's work is not a server answering requests. A backfill runs once, a report runs every night, a cleanup endpoint needs calling every hour. BWEZE has three ways to run it:

|               | Runs                                         | Use it for                               |
| ------------- | -------------------------------------------- | ---------------------------------------- |
| Job           | A command, once, on a service's live release | Backfills, one-time scripts, data fixes  |
| Cron job      | A command, on a schedule, as its own service | Nightly reports, cleanups, syncs         |
| Scheduled URL | A `GET` to a URL, on a schedule              | Calling an endpoint your app already has |

## Run a one-off job

A job runs one command on a service's live release, in a new instance with the same image and environment variables. It keeps its logs after it ends.

```bash
# Runs on the live release and prints its output; the CLI exits with the command's code.
bweze jobs run <serviceId> -- npm run backfill --since 2026-11-01

# Start it and return its ID without waiting.
bweze jobs run <serviceId> -d --time-limit 2h -- ./scripts/reindex.sh

bweze jobs list <serviceId>
bweze jobs logs <serviceId> <jobId> --follow
bweze jobs cancel <serviceId> <jobId>
```

Because `bweze jobs run` exits with the code of the command it ran, a script can tell whether the job worked. You can also start a job from the service's **Jobs** panel in the dashboard, or from the API:

```bash
curl -X POST https://api.bweze.com/v1/services/SERVICE_ID/jobs \
  -H "authorization: Bearer bw_sk_..." -H "content-type: application/json" \
  -d '{ "command": "npm run backfill", "timeout_seconds": 3600 }'
```

- A job is stopped at its time limit: one hour unless you set another, from one minute to twelve hours (`timeout_seconds` from 60 to 43,200).
- Up to three jobs run at once per service. A fourth is refused with `429 too_many_jobs`.
- The service needs a live release (`409 not_deployed` otherwise), and hosting must not be stopped for an empty wallet (`402 workspace_suspended`).
- Running or stopping a job needs an API token with `terminal:exec`, since the command runs with the service's secrets. Reading runs and logs needs `deployment:read`.
- `GET /v1/services/{id}/jobs/{jobId}?after=<line id>` returns the run and up to 2,000 log lines after the one you last saw, so a script can poll for more.

## Schedule a command with a cron job

A cron job is a service whose start command runs on a schedule; nothing runs between runs. Pick **Cron job** as the service type when you [deploy the repo](/guides/deploy-from-github/), set the start command to what each run should execute, then set the schedule and time limit:

```bash
bweze services set <serviceId> --start-command "node dist/report.js"
bweze services set <serviceId> --schedule "0 2 * * *" --time-limit 30m
```

In the API, the same settings are `cron_schedule` and `cron_timeout_seconds` on `PATCH /v1/services/{id}`.

- A run is stopped at its time limit: one hour unless you set another, twelve hours at most.
- A run never overlaps the one before it. If one is still going when the next is due, the next is skipped and listed as skipped.
- `bweze jobs list <serviceId>` shows past runs and the next ones.
- A cron job listens on no port; setting a port on it is refused with `invalid_port`.

## Write the schedule

A cron job's schedule has five fields, in **UTC**: `minute hour day-of-month month day-of-week`. One that is not five fields is refused with `invalid_cron_schedule`. In standard cron, `*` stands for every value of a field, and day of week counts from 0 for Sunday.

| Schedule     | Runs                                   |
| ------------ | -------------------------------------- |
| `0 2 * * *`  | 02:00 UTC every day (04:00 in Kigali)  |
| `0 * * * *`  | At the start of every hour             |
| `30 7 * * 1` | 07:30 UTC every Monday                 |
| `0 0 1 * *`  | Midnight UTC on the 1st of every month |

Standard cron also has ranges, lists and steps such as `*/15`. The BWEZE docs describe only the five fields, so these examples use numbers and `*`.

## Call a URL on a schedule

If your app already has an endpoint that does the work, a scheduled URL calls it with a plain `GET` on a cron schedule. Add one on the project's **Cron jobs** page, or from the CLI:

```bash
bweze projects cron create <projectId> -n nightly-report -s "0 6 * * *" -u https://acme.bweze.app/api/report
bweze projects cron list <projectId>
bweze projects cron disable <jobId>
```

In the API, `POST /v1/projects/{id}/cron` takes `name`, `schedule` and `target_url`, and `PATCH /v1/cron/{id}` turns one on or off with `enabled`.

Each call times out after 20 seconds and does not follow redirects. It carries no signature, so make the endpoint safe for anyone to call, or check a secret in the URL. For work that takes longer than 20 seconds, use a cron job.

## How they are billed

Jobs, cron runs and pre-deploy commands are billed like their service while they run: memory at 20 RWF per GiB-hour for the size configured, and CPU at 30 RWF per CPU-hour for what they use. Between cron runs nothing runs, so nothing is billed. The price list has no meter for scheduled URLs; the work happens in whatever the URL points at.

That makes a cron job cheaper than a worker that stays up all day for one task. Here is a report that takes 10 minutes a night, on a service's 512 MiB and its full 0.5 CPU:

**A nightly report as a cron job, one month**

| What | Amount | Rate | Cost |
| --- | --- | --- | --- |
| Memory, 512 MiB for 10 minutes a night, 30 nights | 2.5 GiB-hours | 20 RWF per GiB-hour | 50 RWF |
| CPU, the full 0.5 CPU while it runs | 2.5 CPU-hours | 30 RWF per CPU-hour | 75 RWF |
| **Before the allowance** | | | **125 RWF** |
| Free allowance: app memory | 2.5 GiB-hours | | -50 RWF |
| Free allowance: app CPU | 2.5 CPU-hours | | -75 RWF |
| **Month** | | | **0 RWF** |

The same report in a background worker that is up all month and mostly idle:

**The same report in an always-on worker, one month**

| What | Amount | Rate | Cost |
| --- | --- | --- | --- |
| Memory, 512 MiB for 730 hours | 365 GiB-hours | 20 RWF per GiB-hour | 7,300 RWF |
| CPU, 2% of one CPU on average | 14.6 CPU-hours | 30 RWF per CPU-hour | 438 RWF |
| **Before the allowance** | | | **7,738 RWF** |
| Free allowance: app memory | 50 GiB-hours | | -1,000 RWF |
| Free allowance: app CPU | 5 CPU-hours | | -150 RWF |
| **Month** | | | **6,588 RWF** |

The time limit also caps what a stuck run can cost. If the wallet runs out and hosting is stopped, queued jobs wait and new ones are refused with `402 workspace_suspended` until a top-up.

## The full reference

[Jobs and cron](https://docs.bweze.com/docs/jobs) in the docs has every command and limit, and [Pricing](https://docs.bweze.com/docs/pricing) explains how usage is measured.

## Sources

- [BWEZE docs: Jobs and cron](https://docs.bweze.com/docs/jobs)
- [BWEZE docs: Services](https://docs.bweze.com/docs/services)
- [BWEZE docs: Pricing](https://docs.bweze.com/docs/pricing)
- [BWEZE docs: Billing](https://docs.bweze.com/docs/billing)
- [BWEZE docs: API reference](https://docs.bweze.com/docs/api)
- [BWEZE docs: CLI](https://docs.bweze.com/docs/cli)
- [crontab(5), Linux manual page](https://man7.org/linux/man-pages/man5/crontab.5.html)
