Using the Children Function
Using the Children Function
Even in a context with static children, it can be useful to iterate over those children
programmatically. This can be done by using the children function, which returns an array of
static children.
1.
For example, here's a script that iterates over every service, printing out the
status of the service:
configuration services
script
50
Oracle ZFS Storage Appliance Administration Guide, Release OS8.6.x • September 2016
properties: {
advanced_analytics: false,
session_timeout: 15,
login_screen: 'status/dashboard',
locale: 'C'
}
}, {
name: 'exceptions',
list: [{
name: 'auth-000',
properties: {
allow_configure: false,
scope: 'alert'
}
}, {
name: 'auth-001',
properties: {
allow_workgroup: false,
allow_domain: false,
name: '*',
scope: 'ad'
}
}]
}]
}]
var svcs = children();
for (var i = 0; i < svcs.length; ++i) {
run(svcs[i]);
try {
printf("%-10s %s\n", svcs[i], get('<status>'));
} catch (err) { }
run("done");