Scripting mode, Creating scripts, Cli commands – HP Secure Key Manager User Manual

Page 244: Manual creation, Executing scripts

Advertising
background image

hostname (config)#

Scripting mode

This section describes how to perform the following actions in scripting mode:

Creating Scripts
Executing Scripts
Displaying and Deleting Scripts
Installing Certificates
Entering Passwords

Creating scripts

There are essentially two different ways to create CLI scripts: manually or via the Script Recorder.

Manual creation

This is done using the command “create script <script name>”, as shown here:
hostname(script)# create script testscript
Perform the following actions to create the script:

Type OR Paste the script immediately after the question mark.

Press Return twice when you have finished.

After you type the command, you are presented with the above directions. You can then either enter

your script line by line or create it using another editor and just paste it in after the question mark. Note

that when you are manually creating scripts, you must take care to format the script file correctly. For

example, when scripting an interactive command (i.e. one that asks for input), the command often

prompts the user multiple times to enter input. You must ensure that each response to a prompt for

input is entered on a separate line in the script file.

NOTE:

The Script Recorder takes care of all such formatting issues and hence is probably the best way to

create scripts initially.

Script recorder

The Script Recorder is started by typing in the command “record <script name>” as shown here:
hostname(script)# record testscript

Recording to script testscript.
You can then type in any “show” or “configure” mode CLI commands and they will automatically be

written to the script specified in the correct format.
To stop the Script Recorder, type “no record” as show here:
hostname(script)# no record

Recording successfully stopped.

Executing scripts

To execute a script, you must first load it using the command “load <script name>”, as shown here:
hostname(script)# load testscript

Script testscript successfully loaded.

244

Using the Command Line Interface

Advertising