# Workers and cron jobs

A worker is an app that runs one command as its process and has no address. A cron app runs one command on a schedule. Both are apps: Astris builds them from a Git repository, like a web app. For the other app commands, see [Apps](/docs/apps).

## Create a worker

The MCP tool `deploy` takes `kind` set to `worker` and a `command`. With the CLI, add these flags to `astris deploy`:

- `--kind worker`
- `--command <command>`

```
astris deploy --project <project> --name <app> --git-url <repository> --branch <branch> --kind worker --command <command>
```

A worker has no address.

## Create a cron app

The MCP tool `deploy` takes `kind` set to `cron`, a `command` and a `schedule`. With the CLI, add `--kind cron`, `--command <command>` and `--schedule <schedule>`.

```
astris deploy --project <project> --name <app> --git-url <repository> --branch <branch> --kind cron --command <command> --schedule <schedule>
```

The schedule has five fields, separated by one space, for example `0 3 * * *`. A cron app keeps running, and the schedule runs the command inside it.

## Rules

- A command has 1 to 512 characters, with no line break.
- A schedule has at most 100 characters. Each field holds only digits and the characters `*`, `,`, `-` and `/`.
- A worker needs a command and takes no schedule. A cron app needs both.
- A worker or a cron app cannot use `--build static`.
- The kind, the command and the schedule are set when you create the app.
- A worker or a cron app has no address. Adding a domain to it is refused with [bad_request](/docs/errors/bad_request): `This app does not serve a website, so it cannot have a domain.`

The CLI refuses a call that breaks a rule and sends nothing. The API refuses it with [bad_request](/docs/errors/bad_request).

## Your plan's pool

A worker or a cron app counts against your plan's pool like any app: the memory it is given, and the same share of CPU and disk. See [Usage](/docs/usage). A new app that does not fit is refused with [upgrade_required](/docs/errors/upgrade_required).
