Understanding The Cli Scripting Commands; Accessing The Cli Script Environment - Oracle ZFS Storage Appliance Administration Manual

Hide thumbs Also See for ZFS Storage Appliance:
Table of Contents

Advertisement

Accessing the CLI Script Environment

select myfs
snapshots snapshot newsnap
Then ssh onto the appliance, redirecting standard input to be the file:
% ssh root@dory < myfile.txt
In many shells, you can abbreviate this by using a "here file", where input up to a token is sent
to standard input. Following is the above example in terms of a here file:
% '''ssh root@dory << EOF
shares
select myproj
select myfs
snapshots snapshot newsnap
EOF'''
This mechanism is sufficient for the simplest kind of automation, and may be sufficient if
wrapped in programmatic logic in a higher-level shell scripting language on a client, but it
generally leaves much to be desired.

Understanding the CLI Scripting Commands

While batching commands is sufficient for the simplest of operations, it can be tedious to wrap
in programmatic logic. For example, if you want to get information on the space usage for
every share, you must have many different invocations of the CLI, wrapped in a higher level
language on the client that parsed the output of specific commands. This results in slow, brittle
automation infrastructure. To allow for faster and most robust automation, the appliance has
a rich scripting environment based on ECMAScript 3. An ECMAScript tutorial is beyond the
scope of this document, but it is a dynamically typed language with a C-like syntax that allows
for:
Conditional code flow (if/else)
Iterative code flow (while, for, etc.)
Structural and array data manipulation via first-class Object and Array types
Perl-like regular expressions and string manipulation (split(), join(), etc.)
Exceptions
Sophisticated functional language features like closures
Accessing the CLI Script Environment
1.
In the CLI, enter the script environment using the script command:
44
Oracle ZFS Storage Appliance Administration Guide, Release OS8.6.x • September 2016

Advertisement

Table of Contents
loading

Table of Contents