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 ...
Cyril_M
Altostratus
Oct 02, 2012Thanks Aaron this rule worked fine on my 11.1 BigIP, except for this little error: you typed static::start_end instead of static::end_date in the 11th line.
when RULE_INIT {
Start of maintenance window in YYYY-mm-dd HH:MM format
set static::start_date "2011-05-29 18:45"
End of maintenance window in YYYY-mm-dd HH:MM format
set static::end_date "2011-05-29 18:50"
Convert start/end times to seconds from the epoch for easier date comparisons
set static::start [clock scan $static::start_date]
set static::end [clock scan $static::start_end]
}
when CLIENT_ACCEPTED {
Save the current time in seconds since the epoch
set now [clock seconds]
Use the maintenance pool if we're in the maintenance window
if {$now > $static::start and $now < $static::end}{
pool MAINT-POOL
}
}
Once corrected, it does the trick pretty well, even when using an european timezone
Regards !
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