Cisco 11503 Administration Guide - Page 300
Script Exit Codes
UPC - 746320664958
View all Cisco 11503 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 300 highlights
Syntax Errors and Script Termination Chapter 8 Using the CSS Scripting Language For example, enter: !no echo socket connect host 192.168.1.1 port 84 tcp socket disconnect ${SOCKET} This script works well as long as neither command fails. However, suppose that the host 192.168.1.1 does not exist. Playing the script produces an error as follows: Error in script playback line:2 >>>socket connect host 192.168.1.1 port 84 tcp CSS11506# Script Playback cancelled. The script failed because of an error in line 2. Notice that the command is not misspelled and all syntax is correct. However, the command issued a non-zero error code because of its failure to connect. The next command, socket disconnect, never executes because of the failure of the first command. The CLI considers this type of error a "syntax error". To discover what went wrong, issue the questionable command directly on the CLI. For example, enter: socket connect host 192.168.1.1 port 84 tcp %% Failed to connect to remote host The CLI displays the reason why the command failed. Note If there are no misspellings in a script, it is good practice to test the commands on the CLI. Script Exit Codes When a script terminates, it returns an exit code. The software places the exit code value in the STATUS variable (for reference after the script is invoked). There are two possible script exit code values: zero (success) and non-zero (failure). To ensure a successful exit code, use the exit script command with a value of zero (the default). The integer value is optional with this command. 8-32 Cisco Content Services Switch Administration Guide OL-5647-02