Using Batch Commands

The simplest scripting mechanism is to batch appliance shell commands. For example, to automatically take a snapshot called newsnap in the project myproj and the filesystem myfs, put the following commands in a file:

shares
select myproj
select myfs
snapshots snapshot newsnap

Then ssh onto the appliance, redirecting standard input to be the file:

$ ssh root@hostname < 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@hostname << 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.