Forum Discussion
Joe_Erchul_4263
Nimbostratus
Oct 28, 2009Rejecting a connection based on address and time of day?
Gang,
I've received a request from our Application folks to drop a connection between a client machine and a database server every day at midnight (or some other wee-morning-hour time)....
naladar_65658
Altostratus
Oct 29, 2009I haven't had a chance to try this out, but I think the general logic MAY look something like this:
1. Create a Datagroup named "ServerAddress" and throw in the IP of the server. If you use a datagroup it can be easier to expand the iRule in the future (IMO).
2. iRule similar to the one below:
when RULE_INIT {
"clock seconds" will return the time in seconds
"clock format" will format the previous value with it's date/time components
split will chop the returned string into a list of elements.
set l [split [clock format [clock seconds] -format {%A %H}] " "]
Next add the time check logic:
if { ([lindex $l 1] >= 0) &&
([lindex $l 1] < 2) } {
Put in iRule logic here
if {([matchclass [IP::client_addr] equals $::ServerAddress])} {
discard
}
}
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