Chapter 8 Using the CSS Scripting Language
Script Keepalive Examples
8-46
Cisco Content Services Switch Administration Guide
OL-5647-02
!
! Notes: Does not use output
!
Will handle out of sockets scenario.
!
! Tested: KGS 12/18/01
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
set OUT-OF-SOCKETS “785”
set NO-CONNECT “774”
! Make sure the user has a qualified number of arguments
if ${ARGS}[#] “LT” “2”
echo “Usage: ap-kal-tcp-ports \'ipAddress tcpPort1 [tcpPort2
tcpPort3...]\'”
exit script 1
endbranch
set SERVICE “${ARGS}[1]”
!echo “SERVICE = ${ARGS}[1]”
var-shift ARGS
while ${ARGS}[#] “GT” “0”
set TCP-PORT “${ARGS}[1]”
var-shift ARGS
function SOCKET_CONNECT call
! If we're out of sockets, exit and look for sockets on the next KAL
interval
if RETURN “==” “${OUT-OF-SOCKETS}”
set EXIT_MSG “Exceeded number of available sockets, skipping until
next interval.”
exit script 0
endbranch
! Valid connection, look to see if it was good
if RETURN “==” “${NO-CONNECT}”
set EXIT_MSG “Connect: Failed to connect to
${SERVICE}:${TCP-PORT}”
exit script 1
endbranch
endbranch
no set EXIT_MSG
exit script 0
function SOCKET_CONNECT begin
set CONTINUE_ON_ERROR “1”
socket connect host ${SERVICE} port ${TCP-PORT} tcp 2000