Forum Discussion
Pierre_Vocat_72
Nimbostratus
Dec 15, 2006Refreshing application variables vi a http redirect
Hi
I am new to irules so please ignore any silly errors / questions.
Our websites use Cold Fusion MX7 and a few of these sites require applications to be refreshed periodically. This is done by a simple .cfm page. The coldfusion service has a tendency to crash so I've set up a html page that calls a .bat file that restarts the service using a series of net stop and net start commands.
I've set up a Virtual server using one of our webservers as a node to serve 3 .cfm pages that check the status of the application variables. These 3 pages are hit every 5 minutes by a standby server.
Below is the irule (I have slightly modified it from another irule I found in a different post on this forum) that I've attached to the virtual server mentioned above.
The Irule checks the response for the different strings that it may recieve if the application variables need to be run and the site that they need to be run on or a response that it would get if the coldfusion service has crashed and is in need of a restart.
when HTTP_RESPONSE {
Collect data for inspection
set clen [HTTP::header Content-Length]
if {$clen > 0} {
HTTP::collect $clen
}
}
when HTTP_RESPONSE_DATA {
Check if site1 needs it's application variables to be refreshed
set found [string first "site1 application variables are not available" [HTTP::payload $clen] ]
Redirect to a page that refreshes site1's application variables
if {$found != -1 } {
HTTP::redirect "http://site1/schedule/structdelete.cfm"
}
Check if site2 needs it's application variables to be refreshed
else {
set found [string first "site2 application variables are not available" [HTTP::payload $clen] ]
Redirect to a page that refreshes site2's application variables
if {$found != -1 } {
HTTP::redirect "http://site2/schedule/structdelete.cfm"
}
Check if site3 needs it's application variables to be refreshed
else {
set found [string first "site3 application variables are not available" [HTTP::payload $clen] ]
Redirect to a page that refreshes site3's application variables
if {$found != -1 } {
HTTP::redirect "http://site3/schedule/application_refresh.cfm"
}
Check for string that tells us the ColdFusion service has crashed
else {
set found [string first "The server encountered an internal error and was unable to complete your request." [HTTP::payload $clen] ]
Redirect to page that will call a .bat file and restart the necessary services
if {$found != -1 } {
HTTP::redirect "http://test-web-site/default.htm"
}
}
}
}
}
Should this irule work? Are there any obvious mistakes that I've made
Any help would be greatly appreciated
Thanks
Pierre
- Colin_Walker_12Historic F5 AccountThe only issue I see right away is that you will probably want to set an "else" condition during the HTTP_RESPONSE portion to ensure that if the clen variable isn't greater than 0, you collect some pre-determined amount of the payload.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects