Forum Discussion
Block traffic to node during specific time period
IheartF5 - Thanks a ton for your help thus far! We modified the code slightly as is shown below. However we aren't yet getting the proper result. Can you explain what the expected behavior of this command should be?
pool [LB::server pool] member $member 80
Thanks again!
Set list of start and end times of each maintenance period set lmaint {{1340 1343} {0300 0330}}
Set list of valid pool member for each maint period set lmember {"1.1.1.1" "2.2.2.2"}
set systemTime [clock seconds]
Set current date set today [clock format $systemTime -format %D%H%M]
Get the current time in seconds since the Unix epoch of 0-0-1970 set now [clock format $systemTime -format %H%M]
Cycle through each maintenance period, checking current time foreach maint $lmaint member $lmember { Convert start/end times to seconds from the epoch for easier date comparisons set start_scanned_value [clock scan "[lindex $maint 0]"] set end_scanned_value [clock scan "[lindex $maint 1]"] Now format the times converted from the epoch set start [clock format $start_scanned_value -format "%H%M"] set end [clock format $end_scanned_value -format "%H%M"] set server [lindex $member 0] log $server Check if the current time is between the start and end times log now.$now log start.$start log end.$end if {$now > $start && $now < $end}{ log local0. "I'm inside the if" pool [LB::server pool] member $server 80 } } Default action is to use the virtual server default pool } '
Recent Discussions
Related Content
* 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