ONTAP CLI scripting, schedules & jobs
The clustered CLI is scriptable when you request stable fields and scope every operation. Its job scheduler is not a general-purpose shell cron: schedules are objects consumed by features such as snapshot policies, while external automation or the REST API runs arbitrary workflows.
Build a stable CLI contract
Use -fields for a compact table and -instance for a complete record. Scope commands with supported -vserver and -node parameters; those are command parameters, not global context switches. -show-fulltext true prevents long values being truncated where that parameter is offered. Confirm each command’s parameters with ? or the command reference for your release.
cluster::> volume show -fields vserver,volume,size,used,percent-used
vserver volume size used percent-used
svm_nas data01 2TB 1.31TB 65%
cluster::> system node show -node node01 -instance
Node: node01
Owner: cluster
Health: true
Eligibility: true
cluster::> event log show -severity ERROR -show-fulltext true
Time Node Severity Event
8/27/2026 10:14:02 node01 ERROR monitor.volume.nearlyFull: ...
Aliases: distinguish names from CLI shortcuts
ONTAP 9.19.1 does not document a general cli alias create command. Commands containing “alias” manage feature data such as tape aliases, CIFS NetBIOS aliases, or FC WWPN aliases—not administrator command abbreviations. Put shortcuts in the external shell or automation tool that invokes SSH/REST, and keep the expanded command in logs.
Batch operations
The admin shell has no portable shell loop. Obtain a bounded list, then loop on the management host. The example below is client-side shell pseudocode: validate quoting, authentication, host keys, and output on a non-production cluster first.
$ for svm in svm_fin svm_eng svm_archive; do
ssh ontap-admin "volume show -vserver $svm -fields volume,size,used"
done
Vserver Volume Size Used
svm_fin ledger 4TB 2.8TB
...
Prefer the automation guide and REST collection filters for larger estates. REST gives structured JSON and HTTP status codes, avoiding screen-scraping. Pagination, asynchronous job links, TLS validation, and least-privilege RBAC still need explicit handling.
Schedules, snapshots, and asynchronous jobs
Create reusable cron or interval schedules, then attach them through the feature that accepts a schedule. A schedule alone executes no arbitrary CLI command. Here a daily schedule is assigned to a snapshot policy:
cluster::> job schedule cron create -name daily-0130 -minute 30 -hour 1
cluster::> job schedule cron show -name daily-0130
Name Description
daily-0130 @1:30
cluster::> job schedule interval create -name every-6h -hours 6
cluster::> job schedule interval show -name every-6h
Name Days Hours Minutes Seconds
every-6h 0 6 0 0
cluster::> volume snapshot policy add-schedule -vserver svm_fin \
-policy nightly -schedule daily-0130 -count 7
cluster::> volume snapshot policy show -vserver svm_fin -policy nightly
Vserver Policy Schedules Enabled
svm_fin nightly daily-0130 true
Many mutating commands return a job ID. Capture it and poll job show -id until a terminal state such as Success or Failure. job pause, job resume, and job delete exist, but applicability depends on job state and type; do not delete a record merely to hide a failed operation. There is no general 9.19.1 job start command for arbitrary work.
cluster::> job show -id 1842 -instance
Job ID: 1842
State: Running
Percent: 63%
Description: Vol Move svm_fin:ledger
cluster::> job pause -id 1842
1 entry was acted on.
system script start starts recording CLI input and output to a session log; it does not run scripts on nodes. Stop and inspect recordings with system script stop and system script show. EMS event handling can notify or trigger AutoSupport; do not assume an undocumented event script facility exists. Use an external event consumer/webhook platform where supported—check your version.
cluster::> system script start -script-name change-4821
cluster::> volume show -vserver svm_fin -volume ledger
cluster::> system script stop
cluster::> system script show
Script Name Start Time Status
change-4821 8/27/2026 11:02:10 completeThree practical reports
Backup inventory
cluster::> volume show -type DP -fields vserver,volume,size,used
vserver volume size used
svm_dr ledger_dr 4TB 2.8TBSnapshot policy report
cluster::> volume show -fields vserver,volume,snapshot-policy
vserver volume snapshot-policy
svm_fin ledger nightlyCapacity report
cluster::> df -h
Filesystem total used avail capacity Mounted on
/vol/ledger/ 4TB 2.8TB 1.2TB 70% /ledger
cluster::> volume show -fields size,used
vserver volume size used
svm_fin ledger 4TB 2.8TBTreat displayed tables as human interfaces. If downstream logic depends on types, units, or exact field names, use REST and normalize values explicitly.
Automation safety
- Make operations idempotent: read current state, change only drift, then read back.
- Fail closed on nonzero SSH status, HTTP error, an ONTAP job Failure/Error state, missing rows, or unexpected multiplicity. ONTAP has no universal CLI
-error-action; implement error policy in the caller. - Use explicit SVM, node, volume, and cluster identifiers. Add allowlists and a dry-run mode around destructive commands.
- Expect long jobs and client timeouts. Poll the returned job instead of repeating the mutation.
- Never embed passwords on command lines. Shell metacharacters, spaces, and history expansion can alter or expose them; use supported secret handling.
- Set a known locale and parse machine data. Human output, dates, decimal separators, units, and columns can vary by release or locale.
- Rate-limit parallel work, log request IDs and before/after state, and use dedicated least-privilege accounts.
For orchestration choices, REST and legacy OnCommand tooling, continue with ONTAP automation and keep the CLI cheatsheet nearby.