# ry job

> Run one command in an app's image on a throwaway machine, and get its result.

```text
ry job [options] [command]
```

## Subcommands

### `ry job run`

Run a command in the app's deployed image, stream its output, exit with its exit code (the command goes after --).

```text
ry job run [options] <app> <command...>
```

Options:

- `-e, --env <KEY=VALUE>`: Env for this job only, laid over the app's secrets (repeatable).
- `-t, --timeout <seconds>`: Stop the job after this many seconds (default 900, at most 3600).
- `-m, --memory <mb>`: Memory of the job's machine in MB (default: the app's).
- `-c, --vcpus <n>`: vCPUs of the job's machine (default: the app's).

Example:

```bash
ry job run web -- npm run migrate
ry job run web --memory 4096 --timeout 1800 -- node scripts/report.js
```

From `ry job run --help`:

```text
Example:
  ry job run shop --memory 4096 -- npm run migrate

Everything after -- is the command, passed on argument by argument. The job keeps running if
this command is interrupted; ry job cancel <id> stops it.
```

### `ry job list`

The app's jobs, newest first (20 per page).

```text
ry job list [options] <app>
```

Options:

- `-n, --limit <n>`: How many (at most 20).
- `--before <createdAt>`: Only jobs created before this - the createdAt of the last job of the previous page.

Example:

```bash
ry job list web
```

### `ry job get`

One job: state, exit code, timing and its recorded output.

```text
ry job get [options] <id>
```

Example:

```bash
ry job get job-1a2b3c4d
```

### `ry job cancel`

Abort a job that is queued or running (its machine is destroyed, the record stays).

```text
ry job cancel [options] <id>
```

Options:

- `-y, --yes`: Confirm without asking (automation, and the way back after consent).

Example:

```bash
ry job cancel job-1a2b3c4d --yes
```
