# Schedules

Run a command, deliver an inbox message or take a backup at a cron time, including while the VM sleeps.

Source: https://slashinfra.com/docs/platform/schedules
Last modified: 2026-11-30T16:36:19.000Z

A schedule runs a command, delivers an inbox message or takes a backup snapshot at a cron time. It fires while the VM sleeps and wakes the VM when it is due, so work at a set time does not need a running VM.

## Create a schedule

A new schedule gets its own id and inherits the project of its VM. Its name is unique on the VM, and the timezone is `UTC` when the request names none. A schedule belongs to one VM, and a snapshot, fork or profile does not copy it.

### Dashboard

- Open [SVMs](https://app.slashinfra.com/svms). 
- Select `worker` in the table to open it. 
- Select the Schedules tab. 
- Select Add schedule. 
- Enter `nightly` in Name. 
- Enter `0 2 * * *` in Cron. 
- Enter `UTC` in Timezone. 
- Choose Run a command in Action. 
- Enter `date >> /home/user/runs.log` in Command. 
- Leave Concurrency at Skip a fire while the last run still runs. 
- Select Add schedule. The table shows `nightly` and its next fire.

### CLI

```bash
si svm schedule add worker --name nightly --cron '0 2 * * *' -- 'date >> /home/user/runs.log'
```

Output

```text
nightly
next fire: 2026-11-30 02:00:00Z
```

The words after `--` are joined with spaces and sent as one command. Without `--tz` the timezone is `UTC`, and without `--concurrency` the rule is `skip`.

### curl

```bash
curl -sS -X POST "https://api.slashinfra.com/svms/worker/schedules" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d '{"name":"nightly","cron":"0 2 * * *","action":{"type":"command","command":"date >> /home/user/runs.log"}}'
```

Output

```text
{"id":"01JCK3AAAAAAAAAAAAAAAAAAAA","project":"proj_6f1c0f0e8a","name":"nightly","cron":"0 2 * * *","timezone":"UTC","action":{"type":"command","command":"date >> /home/user/runs.log"},"concurrency":"skip","enabled":true,"next_at":1796004000000,"created_ms":1795957757410}
```

### Python

```python
import os, requests

res = requests.post(
"https://api.slashinfra.com/svms/worker/schedules",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
json={
"name": "nightly",
"cron": "0 2 * * *",
"action": {"type": "command", "command": "date >> /home/user/runs.log"},
},
)
res.raise_for_status()
print(res.json()["name"])
```

Output

```text
nightly
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SI_API_KEY!}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'nightly',
cron: '0 2 * * *',
action: { type: 'command', command: 'date >> /home/user/runs.log' },
}),
})
if (!res.ok) throw new Error(await res.text())
console.log(((await res.json()) as { name: string }).name)
```

Output

```text
nightly
```

## Choose the action of a schedule

A `command` action runs a shell command in the VM with `bash -lc`. Give it a `timeout_s` from 1 to 86400 seconds, or omit it for no limit.

An `inbox` action puts a message into the VM’s inbox at the due time. The message comes from the schedule name, and the inbox of the VM must be on; a VM with its inbox off answers 400 `inbox_disabled`. The CLI takes `--inbox-subject` and `--inbox-text` instead of a command after `--`. In the dashboard, choose Message the inbox in Action, then fill Subject and Message.

A `snapshot` action captures the disk of the VM as a `backup` snapshot named `<schedule>-YYYYMMDDTHHMMSSZ`, then deletes the oldest backups of this schedule beyond `keep`, from 1 to 100. An optional `before` command runs first with a limit of 60 seconds; a non-zero exit records the run as `failed` and takes no snapshot. The dashboard and the CLI create only command and inbox actions; a snapshot action needs the API.

## Set the cron and time zone

The cron has five fields: minute, hour, day of month, month and weekday. `0 2 * * *` fires at 02:00 every day. Extra spaces between fields are normalized to one. The schedule reads the cron on the clock of its timezone; the default is `UTC`, and `europe/berlin` is stored as `Europe/Berlin`.

Two fires must be at least five minutes apart. A cron whose next two fires are closer than five minutes apart answers 400 `schedule_too_frequent`, and a cron that does not have five fields or never fires answers 400 `invalid_cron`.

The minute tick claims a due schedule and moves `next_at` to the first fire after the tick. The tick wakes a sleeping VM for the fire, so a schedule works whether the VM is asleep or awake. A tick that was down fires one overdue run and does not catch up every missed minute. A run that reaches the queue more than five minutes late is recorded `missed` and does not run.

## List schedules

The list is by name, and each row has the schedule id, its cron, its next fire and its on or off state. A VM with no schedules gets `[]`.

### Dashboard

- Open [SVMs](https://app.slashinfra.com/svms). 
- Select `worker` in the table to open it. 
- Select the Schedules tab. The table lists each schedule, when it fires next and its last run.

### CLI

```bash
si svm schedule ls worker
```

Output

```text
id                          name     cron       next                  state
01JCK3AAAAAAAAAAAAAAAAAAAA  nightly  0 2 * * *  2026-11-30 02:00:00Z  on
```

### curl

```bash
curl -sS "https://api.slashinfra.com/svms/worker/schedules" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
[{"id":"01JCK3AAAAAAAAAAAAAAAAAAAA","project":"proj_6f1c0f0e8a","name":"nightly","cron":"0 2 * * *","timezone":"UTC","action":{"type":"command","command":"date >> /home/user/runs.log"},"concurrency":"skip","enabled":true,"next_at":1796004000000,"created_ms":1795957757410}]
```

### Python

```python
import os, requests

res = requests.get(
"https://api.slashinfra.com/svms/worker/schedules",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
for schedule in res.json():
print(schedule["name"], schedule["cron"], schedule["timezone"])
```

Output

```text
nightly 0 2 * * * UTC
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules', {
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
const schedules = (await res.json()) as { name: string; cron: string; timezone: string }[]
for (const schedule of schedules) console.log(schedule.name, schedule.cron, schedule.timezone)
```

Output

```text
nightly 0 2 * * * UTC
```

## Show a schedule

Show returns one schedule with its next fire in `next_at`, in milliseconds since the Unix epoch. The id belongs to the VM, and an id that names no schedule of that VM answers 404 `schedule_not_found`.

### curl

```bash
curl -sS "https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
{"id":"01JCK3AAAAAAAAAAAAAAAAAAAA","project":"proj_6f1c0f0e8a","name":"nightly","cron":"0 2 * * *","timezone":"UTC","action":{"type":"command","command":"date >> /home/user/runs.log"},"concurrency":"skip","enabled":true,"next_at":1796004000000,"created_ms":1795957757410}
```

### Python

```python
import os, requests

res = requests.get(
"https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
schedule = res.json()
print(schedule["name"], schedule["cron"], schedule["next_at"])
```

Output

```text
nightly 0 2 * * * 1796004000000
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA', {
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
const schedule = (await res.json()) as { name: string; cron: string; next_at: number }
console.log(schedule.name, schedule.cron, schedule.next_at)
```

Output

```text
nightly 0 2 * * * 1796004000000
```

## Change a schedule

A change keeps the id and the run history, and recomputes `next_at` from now. Send only the fields you want to change; `action` replaces the whole action, so include every field of the new action.

The CLI changes only whether the schedule is on or off, with `si svm schedule enable` and `disable`. For a new name, cron, timezone, action or concurrency, send the request or delete the schedule and create it again.

### curl

```bash
curl -sS -X PATCH "https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d '{"cron":"0 3 * * *"}'
```

Output

```text
{"id":"01JCK3AAAAAAAAAAAAAAAAAAAA","project":"proj_6f1c0f0e8a","name":"nightly","cron":"0 3 * * *","timezone":"UTC","action":{"type":"command","command":"date >> /home/user/runs.log"},"concurrency":"skip","enabled":true,"next_at":1796007600000,"created_ms":1795957757410}
```

### Python

```python
import os, requests

res = requests.patch(
"https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
json={"cron": "0 3 * * *"},
)
res.raise_for_status()
print(res.json()["cron"], res.json()["next_at"])
```

Output

```text
0 3 * * * 1796007600000
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.SI_API_KEY!}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ cron: '0 3 * * *' }),
})
if (!res.ok) throw new Error(await res.text())
const schedule = (await res.json()) as { cron: string; next_at: number }
console.log(schedule.cron, schedule.next_at)
```

Output

```text
0 3 * * * 1796007600000
```

## Enable or disable a schedule

Disable keeps the row and stops the minute tick, and the row still stores a next fire. Enable turns the tick back on. Either change recomputes `next_at` from now. Run now works either way. An API request sends `{"enabled":false}` or `{"enabled":true}` to the change operation.

### Dashboard

- Open [SVMs](https://app.slashinfra.com/svms). 
- Select `worker` in the table to open it. 
- Select the Schedules tab. 
- Select More actions on `nightly`. 
- Select Disable. The name gets a `disabled` label. 
- Select More actions on `nightly` again. 
- Select Enable to turn it back on.

### CLI

```bash
si svm schedule disable worker 01JCK3AAAAAAAAAAAAAAAAAAAA
```

Output

```text
nightly disabled
```

```bash
si svm schedule enable worker 01JCK3AAAAAAAAAAAAAAAAAAAA
```

Output

```text
nightly enabled
```

## Run a schedule now

Run now queues one fire immediately, even when the schedule is disabled, and it does not move `next_at`. The API answer carries the run id and its due time, and the CLI prints the run id. The run appears in the history once it is recorded, and a queued run wakes a sleeping VM.

### Dashboard

- Open [SVMs](https://app.slashinfra.com/svms). 
- Select `worker` in the table to open it. 
- Select the Schedules tab. 
- Select More actions on `nightly`. 
- Select Run now. The dashboard says `A run of nightly is queued`.

### CLI

```bash
si svm schedule run worker 01JCK3AAAAAAAAAAAAAAAAAAAA
```

Output

```text
01JCK3AAAAAAAAAAAAAAAAAAAA:1795957723892
```

### curl

```bash
curl -sS -X POST "https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA/run" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
{"run":"01JCK3AAAAAAAAAAAAAAAAAAAA:1795957766661","due_ms":1795957766661}
```

### Python

```python
import os, requests

res = requests.post(
"https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA/run",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
print(res.json()["run"])
```

Output

```text
01JCK3AAAAAAAAAAAAAAAAAAAA:1795957815884
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA/run', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
console.log(((await res.json()) as { run: string }).run)
```

Output

```text
01JCK3AAAAAAAAAAAAAAAAAAAA:1795957858233
```

## List the runs of a schedule

The history has the last 50 fires, newest first. Each row has the due time, the start time, the status, the guest job number and a note. A schedule that never ran gets `[]`. For a command action, `job` is the number of the VM’s job, and `si job logs` reads that job’s output.

### Dashboard

- Open [SVMs](https://app.slashinfra.com/svms). 
- Select `worker` in the table to open it. 
- Select the Schedules tab. 
- Select More actions on `nightly`. 
- Select Last runs. The panel lists the status, job, due time and note of each run.

### CLI

```bash
si svm schedule runs worker 01JCK3AAAAAAAAAAAAAAAAAAAA
```

Output

```text
due                   started               status   job  detail
2026-11-29 13:08:43Z  2026-11-29 13:08:50Z  started  1    -
```

### curl

```bash
curl -sS "https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA/runs" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
[{"id":"01JCK3AAAAAAAAAAAAAAAAAAAA:1795957766661","due_ms":1795957766661,"started_ms":1795957773058,"status":"started","job":1,"detail":null}]
```

### Python

```python
import os, requests

res = requests.get(
"https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA/runs",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
for run in res.json():
print(run["status"], run["job"])
```

Output

```text
started 1
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA/runs', {
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
const runs = (await res.json()) as { status: string; job: number | null }[]
for (const run of runs) console.log(run.status, run.job)
```

Output

```text
started 1
```

## Delete a schedule

Delete removes the schedule and its run history, and a run that is already queued fires nothing. It cannot be undone. Deleting the VM deletes its schedules and their runs too. The dashboard waits five seconds, and Undo keeps the schedule.

### Dashboard

- Open [SVMs](https://app.slashinfra.com/svms). 
- Select `worker` in the table to open it. 
- Select the Schedules tab. 
- Select More actions on `nightly`. 
- Select Delete. The delete runs after five seconds, and Undo keeps the schedule.

### CLI

```bash
si svm schedule rm worker 01JCK3AAAAAAAAAAAAAAAAAAAA
```

Output

```text
deleted schedule 01JCK3AAAAAAAAAAAAAAAAAAAA
```

### curl

```bash
curl -sS -i -X DELETE "https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
HTTP/2 204
...
```

### Python

```python
import os, requests

res = requests.delete(
"https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
print(res.status_code)
```

Output

```text
204
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA', {
method: 'DELETE',
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
console.log(res.status)
```

Output

```text
204
```

## Options

The fields of create and change. A change sends only the fields it changes, and `action` replaces the whole action.

| Field | Type | Default | Allowed values | What it changes |
| --- | --- | --- | --- | --- |   
| `name` (`--name`) | string | Required | `^[a-z0-9-]{1,40}$`, unique on the VM | The name of the schedule. | 
| `cron` (`--cron`) | string | Required | Five fields: minute, hour, day of month, month, weekday; the next two fires at least five minutes apart | When it fires, on the clock of the timezone. | 
| `timezone` (`--tz`) | string | `UTC` | An IANA name such as `Europe/Berlin` | The clock that the cron follows. | 
| `action.type` | string | Required | `command`, `inbox` or `snapshot` | Whether a fire runs a command, puts a message into the inbox or takes a backup snapshot. | 
| `action.command` | string | Required for `command` | A non-empty command | The shell command, run in the VM with `bash -lc`. | 
| `action.timeout_s` (`--timeout`) | integer | No limit | 1 to 86400 | The time limit of the command. | 
| `action.subject` (`--inbox-subject`) | string | Required for `inbox` | Any string | The subject of the inbox message. | 
| `action.text` (`--inbox-text`) | string | Required for `inbox` | A non-empty string | The text of the inbox message. | 
| `action.keep` | integer | Required for `snapshot` | 1 to 100 | How many `backup` snapshots of this schedule stay; older ones are deleted. | 
| `action.before` | string | None | A non-empty command | A command that runs before the capture; a non-zero exit fails the run and takes no snapshot. | 
| `concurrency` (`--concurrency`) | string | `skip` | `skip` or `allow` | What a fire does while the previous run still runs. The dashboard calls them Skip a fire while the last run still runs and Start both when a fire overlaps. | 
| `enabled` | boolean | `true` | `true` or `false` | Whether the minute tick fires the schedule. The CLI uses `si svm schedule enable` and `si svm schedule disable`. | 
| `project` (query, `--project`) | string | `default` | A project name, or its `proj_` id | The project that holds the VM; the schedule inherits it. | 
| `ref` (path, `<SVM>`) | string | Required | A VM name, or its id | The VM whose schedules these are. | 
| `id` (path, `<SCHEDULE>`) | string | Required | The schedule id from the list | The schedule that show, change, run, runs and delete act on. |

## States

A schedule is enabled or disabled, and each fire has one of four run states.

| State | What it means for you | What you can do |
| --- | --- | --- |   
| `enabled` | The minute tick fires the schedule at `next_at`. | Run it now, disable it, or change it. | 
| `disabled` | The row stays, and nothing fires. `next_at` still holds a time. | Run it now, enable it, or delete it. | 
| `started` | The node accepted a command, the inbox stored the message, or the snapshot was taken. A command run keeps this state after the command ends. | Read the job log for a command, the inbox for a message, or the snapshot list for a backup. | 
| `skipped` | A fire found the previous run still running, and `concurrency` is `skip`. Nothing ran. | Wait for the next fire, or set `concurrency` to `allow`. | 
| `missed` | The fire reached the queue more than five minutes late. Nothing ran. | Check that the VM and the queue were up, and wait for the next fire. | 
| `failed` | The node refused the run, the `before` command failed, or the snapshot was not taken. | Read `detail`; the next fire runs as usual. |

## Errors

| Code | When | Fix |
| --- | --- | --- |   
| [`invalid_name`](https://slashinfra.com/docs/reference/errors#invalid_name) | Create or change sends a name that breaks the rule in Options. | Send 1 to 40 lowercase letters, digits or hyphens. | 
| [`name_taken`](https://slashinfra.com/docs/reference/errors#name_taken) | Create or change uses a name another schedule of the VM has. | Choose another name. | 
| [`invalid_cron`](https://slashinfra.com/docs/reference/errors#invalid_cron) | The cron is malformed, does not have five fields, or never fires. | Send five fields, minute first, that fire at least twice. | 
| [`schedule_too_frequent`](https://slashinfra.com/docs/reference/errors#schedule_too_frequent) | The next two fires are closer than five minutes apart. | Use a longer interval. | 
| [`invalid_timezone`](https://slashinfra.com/docs/reference/errors#invalid_timezone) | The timezone is not an IANA name that the API knows. | Use a name such as `Europe/Berlin`, or omit it for `UTC`. | 
| [`invalid_action`](https://slashinfra.com/docs/reference/errors#invalid_action) | `action.type` is not `command`, `inbox` or `snapshot`, or an inbox action lacks its subject or text. | Send a known type with the fields it needs. | 
| [`invalid_command`](https://slashinfra.com/docs/reference/errors#invalid_command) | A command, or the `before` command, is empty. | Send a non-empty command. | 
| [`invalid_timeout`](https://slashinfra.com/docs/reference/errors#invalid_timeout) | `timeout_s` is outside 1 to 86400, or is not a whole number. | Send a whole number in that range, or omit it. | 
| [`invalid_keep`](https://slashinfra.com/docs/reference/errors#invalid_keep) | `keep` is missing or outside 1 to 100. | Send a whole number in that range. | 
| [`invalid_concurrency`](https://slashinfra.com/docs/reference/errors#invalid_concurrency) | `concurrency` is not `skip` or `allow`. | Send one of the two values. | 
| [`inbox_disabled`](https://slashinfra.com/docs/reference/errors#inbox_disabled) | An inbox action names a VM whose inbox is off. | Turn the inbox on, or use a command action. | 
| [`schedule_limit`](https://slashinfra.com/docs/reference/errors#schedule_limit) | Create would exceed the 10 schedules of the VM. | Delete a schedule, or ask about your plan. | 
| [`schedule_not_found`](https://slashinfra.com/docs/reference/errors#schedule_not_found) | The id names no schedule of the VM. | Check the id from the list. |

Errors that any request can return are in the [error catalog](https://slashinfra.com/docs/reference/errors).

## Permissions

| Operation | Who can | Key action |
| --- | --- | --- |   
| Create a schedule | Any member | `schedule:write` | 
| List schedules | Any member | `schedule:read` | 
| Show a schedule | Any member | `schedule:read` | 
| Change a schedule | Any member | `schedule:write` | 
| Enable or disable a schedule | Any member | `schedule:write` | 
| Run a schedule now | Any member | `svm:exec` | 
| List the runs of a schedule | Any member | `schedule:read` | 
| Delete a schedule | Any member | `schedule:delete` |

## Limits

- A VM holds 10 schedules. An 11th create answers 409 `schedule_limit`. 
- The next two fires of a schedule must be at least five minutes apart. A cron whose next two fires are closer answers 400 `schedule_too_frequent`. 
- A schedule name has 1 to 40 lowercase letters, digits and hyphens, and it is unique on the VM. 
- A schedule fires within about 90 seconds of its time. 
- A fire that reaches the queue more than five minutes late is `missed` and does not run. 
- A tick that was down fires one overdue run, not every missed one. 
- The run history keeps the last 50 fires, and older runs are deleted as new ones are recorded. 
- A command action has a time limit from 1 to 86400 seconds when `timeout_s` is set; without it the schedule sets no time limit. 
- A snapshot action keeps 1 to 100 backups of its schedule. Older backups are deleted after a successful capture.

The full list is in [Limits](https://slashinfra.com/docs/reference/limits).

## Next

- [Sleep and wake](https://slashinfra.com/docs/how/sleep-and-wake): why a sleeping VM needs a schedule for work at a set time. 
- [Email](https://slashinfra.com/docs/platform/email): an inbox message that a schedule can deliver. 
- [Services](https://slashinfra.com/docs/platform/services): a program that should always run, rather than at a set time.
