commands – io export
Export all, or part of, the servers configuration to a JSON or YAML file.
Usage
export [item …] root [(json|yaml|yml)] [relative]
export [item …] root file.(json|yaml|yml) [relative] [verbose]
where
item | one or more item types to include in the export. Default = calendars, jobs & properties. |
|
acls | export acls. | |
calendars | export calendars. | |
configs | export configs, if root is / . |
|
hosts | export host acls, if root is / . |
|
jobs | export jobs. | |
properties | export properties. | |
protected | export protected users and hosts, if root is / . |
|
all | export all the above item types, if root is / . Otherwise, include all the above items except hosts & protected . |
|
root | group whose contents to export. | |
json|yaml|yml | output as JSON or YAML to the console. Default = yaml . |
|
file.(json|yaml|yml) | output as JSON or YAML to the specified file. | |
relative | use relative (to root) names within the output JSON/YAML. | |
verbose | print name of all items exported, instead of counts of each item type exported. |
read for acl, calendar & job items.
Examples
Export a group to the console as JSON
As a user with read only access, export the group /examples/webhooks to the console as JSON.
BeyondCron % export /examples/webhooks json
{"jobs": [ { "name": "/examples/webhooks/critical-mass", "description": "San Francisco critical mass in 30 mins", "type": "URL", "mode": "ENABLED", "timezone": "US/Pacific", "schedules": [{ "type": "MONTHLY", "day": "FRIDAY", "time": "17:00:00", "position": 1, "last": true }], "properties": [ { "name": "PATH", "value": "/var/opt/demo/bin:/usr/bin:/bin" }, ], "url": "https://hooks.slack.com/services/T052K944E/B077HCJF7/fSMqAZpfirT.......yNdmZgX", "method": "JSON" }, { "name": "/examples/webhooks/private-property", "description": "Call an AWS webhook with a private header API key", "type": "URL", "mode": "ENABLED", "timezone": "Asia/Tokyo", "schedules": [{ "type": "REPEAT", "period": "30 minutes", "epoch": 1440920870665 }], "properties": [ { "name": "PATH", "value": "/var/opt/demo/bin:/usr/bin:/bin" }, { "name": "hp:x-api-key", "value": "********" } ], "url": "https://5s...6f.execute-api.us-west-2.amazonaws.com/prod/random-result", "method": "JSON" } ]
the value of the property x-api-key in job /examples/webhooks/private-property, is masked since the user does not have write access to the job.
Export a group to the console as YAML
Export the same group to the console as YAML.
BeyondCron % export /examples/webhooks
jobs: - name: /examples/webhooks/critical-mass description: San Francisco critical mass in 30 mins type: URL mode: ENABLED timezone: US/Pacific schedules: - type: MONTHLY day: FRIDAY time: '17:00:00' position: 1 last: true properties: - {name: PATH, value: /var/opt/demo/bin:/usr/bin:/bin} url: https://hooks.slack.com/services/T052K944E/B077HCJF7/fSMqAZpfirT.......yNdmZgX method: JSON - name: /examples/webhooks/private-property description: Call an AWS webhook with a private header API key type: URL mode: ENABLED timezone: Asia/Tokyo schedules: - type: REPEAT period: 30 minutes epoch: 1440920870665 properties: - {name: PATH, value: /var/opt/demo/bin:/usr/bin:/bin} - {name: 'hp:x-api-key', value: '********'} url: https://5s...6f.execute-api.us-west-2.amazonaws.com/prod/random-result method: JSON
Export a group to the console as relative YAML
Export the same group to the console as relative YAML.
BeyondCron % export /examples/webhooks relative
jobs: - name: .../critical-mass description: San Francisco critical mass in 30 mins type: URL mode: ENABLED timezone: US/Pacific schedules: - type: MONTHLY day: FRIDAY time: '17:00:00' position: 1 last: true properties: - {name: PATH, value: /var/opt/demo/bin:/usr/bin:/bin} url: https://hooks.slack.com/services/T052K944E/B077HCJF7/fSMqAZpfirT.......yNdmZgX method: JSON - name: .../private-property description: Call an AWS webhook with a private header API key type: URL mode: ENABLED timezone: Asia/Tokyo schedules: - type: REPEAT period: 30 minutes epoch: 1440920870665 properties: - {name: PATH, value: /var/opt/demo/bin:/usr/bin:/bin} - {name: 'hp:x-api-key', value: '********'} url: https://5s...6f.execute-api.us-west-2.amazonaws.com/prod/random-result method: JSON
Export a group to a file
Export the same group to the a file as YAML, printing the names of each item exported.
BeyondCron % export /examples/webhooks /…/webhooks.yaml verbose
Exported: - /examples/webhooks/critical-mass (JOB) - /examples/webhooks/private-property (JOB)
Export entire configuration to a file
Export the entire configuration to a JSON file, printing a count of each item exported.
BeyondCron % export all / /…/server.json
Exported 8 Calendars & 33 Jobs.