Brad_146558
Oct 18, 2016Nimbostratus
Time based iRule question
Hi everyone,
I'm writing an iRule that triggers a daily maintenance page. I'm trying to get this page to come up between two certain time periods each and every day. I used an iRule I'd found in an article from hoolio as I'd never done a time based iRule before. I'm running into an error that I posted just below the iRule. I'm thinking that I'm receiving this because I don't have the appropriate wild cards in for the dates. Any help would be appreciated! 😃
when RULE_INIT {
Start of maintenance window in YYYY-mm-dd HH:MM format
set static::start_date "11:00"
End of maintenance window in YYYY-mm-dd HH:MM format
set static::end_date "5:00"
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::end_date]
}
when CLIENT_ACCEPTED {
Get the current time in seconds since the Unix epoch of 0-0-1970
set now [clock seconds]
Check if the current time is between the start and end times
if {$now > $static::start and $now < $static::end}{
pool my_maintenance_pool
}
Default action is to use the virtual server default pool
}
- can't read "static::end": no such variable while executing "if {$now >$static::start and $now < $static::end}{ pool my_maintenance_pool }"