Exit_Msg Variable - Cisco 11503 - CSS Content Services Switch Administration Manual

Content services switch
Hide thumbs Also See for 11503 - CSS Content Services Switch:
Table of Contents

Advertisement

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.
Cisco Content Services Switch Administration Guide
8-19
OL-5647-02

Advertisement

Table of Contents
loading

This manual is also suitable for:

11500 series

Table of Contents