Cron Jobs / Scheduled Wake-ups
Scheduled operations let you automatically start, stop, delete, or exec a command in instances on a calendar-based schedule.
Each scheduled operation specifies a name, a calendar expression, and an action (start, stop, delete, or exec).
When you clone an instance from a template, the clone inherits its scheduled operations.
You can currently only manage schedules via the API or unikraft api.
Calendar expression format
Unikraft Cloud uses systemd calendar events (see systemd.time(7)).
Calendar expressions have the following fields:
The expression syntax supports ranges, steps, and comma-separated lists:
| Syntax | Description |
|---|---|
* | Any value |
5 | Exact value |
1..5 | Range |
1..5/2 | Range with step |
1,2,5 | Comma-separated list |
Setting a schedule at instance creation
Pass schedules in the create request.
For example, to start an instance every day at 09:00 UTC and stop it at 18:00 UTC:
To run a command inside the instance every night at midnight, use the exec action with an args array:
Updating schedules of an existing instance
Add, set, or remove scheduled operations via PATCH:
Add an exec schedule the same way, but include args with the command to run:
Actions
| Action | Description |
|---|---|
start | Start the instance at the scheduled time |
stop | Stop the instance at the scheduled time |
delete | Delete the instance at the scheduled time |
exec | Execute a command inside the instance at the scheduled time. Requires the args field. |
The args field is an array of strings specifying the command to run when using the exec action.
The first element is the executable and the remaining elements are its arguments.
No need to specify it for all other actions.
Learn more
- Unikraft Cloud's REST API reference, in particular the section on instances.