Forum Discussion
Tim_Moomaw_9220
Nimbostratus
Nov 09, 2008Scheduled Maintenance Window
--- Obligatory "I'm new to iRules" ----
I'm trying to create a rule to return a maintenance page every Saturday morning between 0200 and 0600. I have copied a few examples ...
Johan_47487
Nimbostratus
Mar 10, 2011Thank you for your help,
Here a modified version, with a forward to another virtual server :)
when HTTP_REQUEST {
set start "10/03 18:00"
set end "11/03 07:00"
scan [clock format [clock seconds] -format {%m %d %k %M}] {%d %s %s %s} cur_month cur_day cur_hour cur_minute
scan $start {%d/%d %d:%d} start_day start_month start_hour start_minute
scan $end {%d/%d %d:%d} end_day end_month end_hour end_minute
set start [expr (${start_month}000000 + ${start_day}0000 + ${start_hour}00 + ${start_minute} )]
set end [expr (${end_month}000000 + ${end_day}0000 + ${end_hour}00 + ${end_minute} )]
set cur_time ${cur_month}${cur_day}${cur_hour}${cur_minute}
if { $cur_time >= $start and $cur_time < $end} {
set url [string tolower "[HTTP::host][HTTP::uri]"]
if {[matchclass unavailable starts_with [HTTP::host]]} {
foreach value [class match -value $url starts_with unavailable] {
set newuri $value
}
if {not [matchclass [HTTP::uri] equals f5_custom_pages]} {
HTTP::uri $newuri
}
virtual F5_CUSTOMS
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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