Script Keepalive Examples
Pinglist Keepalive
Cisco Content Services Switch Administration Guide
8-54
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-pinglist
! Parameters: HostName1 HostName2 HostName3, etc.
!
! Description:
!
This script is designed to ping a list of hosts that the user
!
passes in on the command line.
!
! Failure Upon:
!
1. Not being able to ping any one of the hosts in the list
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ${ARGS}[#] "LT" "1"
echo "Usage: ap-kal-pinglist \'HostName1 HostName2 HostName3
...\'"
exit script 1
endbranch
while ${ARGS}[#] "GT" "0"
set Host "${ARGS}[1]"
var-shift ARGS
function PingHost call "${Host}"
endbranch
no set EXIT_MSG
exit script 0
function PingHost begin
! Ping the first host
ping ${ARGS}[1] | grep -u Success
if STATUS "NEQ" "0"
show variable UGREP | grep 100
if STATUS "==" "0"
set EXIT_MSG "Ping: Failure to ping ${ARGS}[1]"
exit script 1
endbranch
endbranch
function PingHost end
Chapter 8
Using the CSS Scripting Language
OL-5647-02