8-51
Cisco Content Services Switch Administration Guide
OL-5647-02
Chapter 8 Using the CSS Scripting Language
Script Keepalive Examples
echo “Getting ${ARGS}[1] from Site ${ARGS}[2]\n”
! Connect to the remote Host
set EXIT_MSG “Connect: Failed to connect to ${ARGS}[1]”
socket connect host ${ARGS}[1] port 80 tcp
! Send the head request
set EXIT_MSG “Send: Failed to send to ${ARGS}[1]”
socket send ${SOCKET} “HEAD ${ARGS}[2] HTTP/1.0\n\n”
! Wait for the status code 200 to be given to us
set EXIT_MSG “Waitfor: Failed to wait for '200' on ${ARGS}[1]”
socket waitfor ${SOCKET} “ 200 “
no set EXIT_MSG
socket disconnect ${SOCKET}
function HeadUrl end
POP3 Keepalive
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-pop3
! Parameters: HostName UserName Password
!
! Description:
! This script will connect to a POP3 server and login with the
! username/password pair specified as argument 2 and 3. After which
! it will log out and return.
!
! Failure Upon:
! 1. Not establishing a connection with the host.
! 2. Not being able to log in with supplied username/password.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ${ARGS}[#] “NEQ” “3”
echo “Usage: ap-kal-pop3 \'Hostname UserName Password\'”
exit script 1
endbranch
! Defines:
set HostName “${ARGS}[1]”
set UserName “${ARGS}[2]”
set Password “${ARGS}[3]”
set EXIT_MSG “Connection Failed”
! Connect to the remote host (use default timeout)
socket connect host ${HostName} port 110 tcp