Forum Discussion
Stuart_Myers_88
Nimbostratus
Dec 08, 2009GTM Pool Redirect based on time
This Works with HTTP_REQUEST, but when i try to use the same thing with DNS_REQUEST, i get:
01070151:3: Rule [redirect] error:
line 1: [undefined procedure:
(...
hoolio
Cirrostratus
Dec 08, 2009I think it's just an issue with not escaping line breaks in your if statement:
when DNS_REQUEST {
Change the following to set schedule
set maintenance_start_day "Saturday";
set maintenance_start_time "0000";
set maintenance_add_day_1 "Sunday";
set maintenance_add_day_2 "";
set maintenance_add_day_3 "";
set maintenance_add_day_4 "";
set maintenance_add_day_5 "";
set maintenance_end_day "Monday";
set maintenance_end_time "0400";
Get time in seconds, formatted as day of week (%A) hour (%k) minute (%M)
Use scan to save output as $cur_day $cur_hour $cur_minute
scan [clock format [clock seconds] -format {%A %k %M}] {%s %d %d} cur_day cur_hour cur_minute
set cur_time ${cur_hour}${cur_minute}
log local0. "\$cur_day: $cur_day, \$cur_hour: $cur_hour, \$cur_minute: $cur_minute, \$cur_time: $cur_time"
if { ($cur_day eq $maintenance_start_day) && \
($cur_time > $maintenance_start_time) && \
($cur_time < "2400") }{
pool STG_Training
}
...
Also, it would probably make sense to add a switch statement (Click here) to check $cur_day instead of using 5 if statements that would all be run where only one could be true.
Aaron
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
