Previous
Deploy software
Viam’s machine job scheduler allows you to configure automated jobs that run on your machines at specified intervals. This enables you to automate routine tasks such as data collection, sensor readings, maintenance operations, and system checks.
The job scheduler is built into viam-server
and executes configured jobs according to their specified schedules. Each job targets a specific resource on your machine and calls a designated method at the scheduled intervals.
{
"components": [ ... ],
"services": [ ... ],
"jobs": [
{
"name": "hourly-job",
"schedule": "0 * * * *",
"resource": "<resource-name>",
"method": "<method-name>"
},
{
"name": "daily-job",
"schedule": "0 8 * * *",
"resource": "<resource-name>",
"method": "<method-name>"
},
{
"name": "periodic-job",
"schedule": "15m",
"resource": "<resource-name>",
"method": "<method-name>"
},
{
"name": "do-command-job",
"schedule": "0 2 * * 0",
"resource": "<resource-name>",
"method": "DoCommand",
"command": {
"key": "calibrate",
"mode": "full"
}
}
]
}
{
"components": [
{
"name": "temp-sensor",
"model": "fake",
"type": "sensor"
},
{
"name": "camera1",
"model": "webcam",
"type": "camera"
}
],
"services": [
{
"name": "data_manager",
"type": "data_manager"
}
],
"jobs": [
{
"name": "hourly-sensor-reading",
"schedule": "0 * * * *",
"resource": "temp-sensor",
"method": "GetReadings"
},
{
"name": "daily-camera-capture",
"schedule": "0 8 * * *",
"resource": "camera1",
"method": "GetImage"
},
{
"name": "periodic-sync",
"schedule": "15m",
"resource": "data_manager",
"method": "Sync"
},
{
"name": "custom-maintenance",
"schedule": "0 2 * * 0",
"resource": "temp-sensor",
"method": "DoCommand",
"command": {
"action": "calibrate",
"mode": "full"
}
}
]
}
Jobs are configured as part of your machine’s configuration. Each job requires the following parameters:
Parameter | Type | Required | Description |
---|---|---|---|
name | string | Required | Unique identifier for the job within the machine. |
schedule | string | Required | Schedule specification using unix-cron format or Golang duration. Accepts
|
resource | string | Required | Name of the target resource (component or service). |
method | string | Required | gRPC method to call on the target resource. |
command | object | Optional | Command parameters for DoCommand operations. |
Monitor job execution through viam-server
logs. Look for rdk.job_manager
:
8/19/2025, 7:38:59 PM info rdk.job_manager.periodic-job jobmanager/jobmanager.go:160 Job succeeded response map[action:true]
8/19/2025, 7:38:59 PM info rdk.job_manager.periodic-job jobmanager/jobmanager.go:155 Job triggered
8/19/2025, 7:51:33 PM warn rdk.job_manager.periodic-job jobmanager/jobmanager.go:151 Could not get resource error could not find the resource for name generic-2
viam-server
is running.viam-server
running.Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!