# Schedules with the CLI

> Create, read, enable, disable and delete runner schedules from the terminal.

Source: https://managerunners.com/docs/cli/schedules/

Schedules pause and resume a runner on a weekly timetable. They need a Pro or Enterprise plan; [Schedules](https://managerunners.com/docs/manual/schedules/) in the manual explains how they work. Reading needs the `schedules:read` scope, which the CLI's login token has; changes need `schedules:write`:

```sh
manage-runners auth login --profile default --scope schedules:write
```

Check whether your organization's plan includes schedules:

```sh
manage-runners subscription show
```

## Create or replace a schedule

```sh
manage-runners schedule set --runner-id 812999368881481087 \
  --zone-id Europe/Berlin \
  --start 07:00 --stop 19:00 \
  --day Mon --day Tue --day Wed --day Thu --day Fri \
  --enabled
```

| Flag | Description |
| --- | --- |
| `--runner-id` | The runner the schedule belongs to |
| `--zone-id` | IANA time zone, for example `Europe/Berlin` or `America/New_York` |
| `--start` | Start time, `HH:MM` |
| `--stop` | Stop time, `HH:MM`, later than `--start` |
| `--duration-minutes` | Instead of `--stop`: window length, 1 to 1440 minutes |
| `--day` | `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat` or `Sun`; repeat for each day, at least one |
| `--enabled` | Enable the schedule. Pass `--enabled=false` to save it disabled. |

Give exactly one of `--stop` and `--duration-minutes`. `--enabled` must always be given explicitly. `schedule set` replaces any existing schedule of the runner.

## Read, enable and disable

```sh
manage-runners schedule get --runner-id 812999368881481087
manage-runners schedule disable --runner-id 812999368881481087
manage-runners schedule enable --runner-id 812999368881481087
```

A disabled schedule keeps its settings and does nothing until you enable it again.

## Delete

```sh
manage-runners schedule delete --runner-id 812999368881481087 --confirm 812999368881481087 --yes
```

Deleting is permanent. Interactively, the CLI asks you to confirm and to type the runner ID. Deleting a runner deletes its schedule as well.

## Errors

Without a Pro or Enterprise plan, schedule commands fail with exit code 4. A runner without a schedule makes `schedule get` fail with exit code 5. Invalid times, days or zones fail with exit code 2 before anything is sent, or with exit code 7 if the API rejects them.
