Skip to content

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.

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.

  1. Open SVMs.
  2. Select worker in the table to open it.
  3. Select the Schedules tab.
  4. Select Add schedule.
  5. Enter nightly in Name.
  6. Enter 0 2 * * * in Cron.
  7. Enter UTC in Timezone.
  8. Choose Run a command in Action.
  9. Enter date >> /home/user/runs.log in Command.
  10. Leave Concurrency at Skip a fire while the last run still runs.
  11. Select Add schedule. The table shows nightly and its next fire.

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.

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.

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 [].

  1. Open SVMs.
  2. Select worker in the table to open it.
  3. Select the Schedules tab. The table lists each schedule, when it fires next and its last run.

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.

Terminal window
curl -sS "https://api.slashinfra.com/svms/worker/schedules/01JCK3AAAAAAAAAAAAAAAAAAAA" \
-H "Authorization: Bearer $SI_API_KEY"
Output
{"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}

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.

Terminal window
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
{"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}

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.

  1. Open SVMs.
  2. Select worker in the table to open it.
  3. Select the Schedules tab.
  4. Select More actions on nightly.
  5. Select Disable. The name gets a disabled label.
  6. Select More actions on nightly again.
  7. Select Enable to turn it back on.

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.

  1. Open SVMs.
  2. Select worker in the table to open it.
  3. Select the Schedules tab.
  4. Select More actions on nightly.
  5. Select Run now. The dashboard says A run of nightly is queued.

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.

  1. Open SVMs.
  2. Select worker in the table to open it.
  3. Select the Schedules tab.
  4. Select More actions on nightly.
  5. Select Last runs. The panel lists the status, job, due time and note of each run.

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.

  1. Open SVMs.
  2. Select worker in the table to open it.
  3. Select the Schedules tab.
  4. Select More actions on nightly.
  5. Select Delete. The delete runs after five seconds, and Undo keeps the schedule.

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.

Scroll horizontally to see all columns.

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.

Scroll horizontally to see all columns.

Code When Fix
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 Create or change uses a name another schedule of the VM has. Choose another name.
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 The next two fires are closer than five minutes apart. Use a longer interval.
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 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 A command, or the before command, is empty. Send a non-empty command.
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 keep is missing or outside 1 to 100. Send a whole number in that range.
invalid_concurrency concurrency is not skip or allow. Send one of the two values.
inbox_disabled An inbox action names a VM whose inbox is off. Turn the inbox on, or use a command action.
schedule_limit Create would exceed the 10 schedules of the VM. Delete a schedule, or ask about your plan.
schedule_not_found The id names no schedule of the VM. Check the id from the list.

Scroll horizontally to see all columns.

Errors that any request can return are in the error catalog.

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

Scroll horizontally to see all columns.

  • 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.

  • Sleep and wake: why a sleeping VM needs a schedule for work at a set time.
  • Email: an inbox message that a schedule can deliver.
  • Services: a program that should always run, rather than at a set time.