EasyManuals Logo
Home>Cisco>Switch>11503 - CSS Content Services Switch

Cisco 11503 - CSS Content Services Switch User Manual

Cisco 11503 - CSS Content Services Switch
392 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #287 background imageLoading...
Page #287 background image
8-19
Cisco Content Services Switch Administration Guide
OL-5647-02
Chapter 8 Using the CSS Scripting Language
Special Variables
In the following example, notice that the error that is most likely to occur is not a
syntax error, but an error with the command being initiated. In this case, a nonzero
value results in a “Failure to connect to remote host” message. This could be a
special case where you want to catch the error and then perform another action
instead.
set CONTINUE_ON_ERROR “1”
socket connect host 1.1.1.1 port 9
if STATUS “NEQ” “0”
echo “Failure to connect to remote host”
endbranch
no set CONTINUE_ON_ERROR
EXIT_MSG Variable
Use the EXIT_MSG variable to tell the CLI to print out a custom message when
a script exits. Typically, you set this variable to a string value that is printed when
the script terminates. Set this variable to prepare for potential errors, and unset it
using the no set command before the script exits cleanly. This variable allows you
to take advantage of the CLI's exit upon error behavior, while permitting the
flexibility of customizing the error message. For example, enter:
set EXIT_MSG “Failure to connect to host”
socket connect host 1.1.1.1 port 9
no set EXIT_MSG
The example above shows how you can create a custom error message that will
print “Failure to connect to host” if the socket connect command returns a
non-zero STATUS variable. When this occurs (unless the
CONTINUE_ON_ERROR variable is set), the script terminates automatically
and the CLI prints the EXIT_MSG string to the screen.
If the socket connect command succeeds, then the CLI executes the next
command in the script. In this case, the script performs a no set EXIT_MSG
command. This allows the script to terminate normally without printing an exit
message to the screen, which would be inappropriate because no error occurred.

Table of Contents

Other manuals for Cisco 11503 - CSS Content Services Switch

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Cisco 11503 - CSS Content Services Switch and is the answer not in the manual?

Cisco 11503 - CSS Content Services Switch Specifications

General IconGeneral
BrandCisco
Model11503 - CSS Content Services Switch
CategorySwitch
LanguageEnglish

Related product manuals