Shell interpreter
The Shell interpreter executes shell commands or scripts as an action in a Chef Courier job, and can be run on both Linux and Windows operating systems.
Use the linux
or windows
commands in your Courier job definition to execute Linux and Windows commands. The syntax is as follows:
"command": {
"linux": ["<LINUX_COMMAND>"],
"windows": ["<WINDOWS_COMMAND>"]
}
Example
The following job executes a shell command:
{
"name": "a sample job",
"description": "a simple job to demonstrate a shell command execution",
"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"
},
"name": "chef-platform/shell-interpreter"
},
"command": {
"linux": ["sleep 10"],
"windows": ["echo 'some sample content'"]
},
"inputs": { },
"expectedInputs": { },
"outputFieldRules": { },
"retryCount": 2,
"failureBehavior": {
"action": "retryThenFail",
"retryBackoffStrategy": {
"name": "none",
"delaySeconds": 0,
"arguments": [1,3,5]
}
},
"limits": { },
"conditions": [ ]
}]
}
}