Restart interpreter
You can use the Restart interpreter to restart Linux and Windows machines in a Courier job.
To restart a machine, use exec
to run the machine_reboot
command as a step in a Courier job definition.
The Courier Runner monitors the job during the restart and reports the job status back when it completes.
The syntax is as follows:
"command":{
"exec": ["machine_reboot"],
"args": {
"time": "1"
}
}
Arguments
The machine_reboot
command accepts the following arguments:
time
- The time in minutes until a restart begins.
Default value:
1
- Linux machines accept any integer value or use
now
to trigger an immediate restart. - Windows machines accept any integer value.
- Linux machines accept any integer value or use
Example
The following Courier job restarts a node:
{
"name": "a sample job",
"description": "A simple job to demonstrate a machine restart",
"scheduleRule": "immediate",
"exceptionRules": [],
"target": {
"executionType": "sequential",
"groups": [{
"timeoutSeconds": 160,
"batchSize": {
"type": "number",
"value": 1
},
"distributionMethod": "rolling",
"successCriteria": [{ "numRuns": { "type": "percent", "value": 100 }, "status": "success" }],
"nodeListType":"nodes",
"nodeIdentifiers": [ "--NODE1--" ]
}]
},
"actions": {
"accessMode": "agent",
"steps": [{
"interpreter": {
"skill": {
"minVersion": "1.0.0",
"maxVersion": "1.9.99"
},
"name": "chef-platform/restart-interpreter"
},
"command": {
"exec": ["machine_reboot"]
},
"inputs": { },
"expectedInputs": { },
"outputFieldRules": { },
"retryCount": 2,
"failureBehavior": {
"action": "retryThenFail",
"retryBackoffStrategy": {
"name": "none",
"delaySeconds": 0,
"arguments": [1,3,5]
}
},
"limits": { },
"conditions": [ ]
}]
}
}