Forum Discussion
Andre_Muniz
Jul 01, 2011Nimbostratus
Schedule iRule
Im new in iRule. Im using a iRule and its ok, but i need to schedule this. I need that iRule to be enabled only a certain part of the day. How can I do that ? Thanks
- Colin_Walker_12Historic F5 AccountJoe actually walks through doing something like this, sort of:
- hooleylistCirrostratus
Here's a simple example as well for 10.x:
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::end_date] } when CLIENT_ACCEPTED { set now [clock seconds] if {$now > $static::start and $now < static::end}{ pool MAINT_POOL } }
Aaron
- steve_88008Nimbostratusi was under the impression that setting the static end date and time the irule would no longer process a redirect or whatever method it was instrcuted. is that not the case?
- steve_88008Nimbostratus
or is this the missing piece?
set now [clock seconds]
if {$now > $static::start and $now < static::end}
- hooleylistCirrostratusHi Steve,
- steve_88008Nimbostratussure, is the code that was shared capable of sending traffic to the maint_pool during the specified date/time frame? If so, after the date/time frame specified has passed, will traffic resume normally to the vip the irule is bound too?
- Michael_YatesNimbostratusHi Steve,
- steve_88008Nimbostratusthanks Michael, that is what i was looking for. now i don't have a "pool" but i do have a url. do you know which command I could use other then pool that works with CLIENT_APPECTED? I tried to use HTTP::redirect but it doesn't seem to work with current event context.
- Michael_YatesNimbostratusHi Steve,
when CLIENT_ACCEPTED { Check Client IP Address Exclusions GO HERE! if { !([matchclass [IP::remote_addr] equals $::MaintenancePageOverride ]) } { If it's not on the exclusion list. Tag it here. set rewrite_response 1 } else { If it is to be excluded, set value here. set rewrite_response 0 } } when HTTP_REQUEST { if { [HTTP::uri] contains "maintenanceaccess" } { set rewrite_response 3 } } when HTTP_RESPONSE { if { $rewrite_response equals "1" } { HTTP::respond 200 content "Site unavailable System Maintenance NOTICE: This website down for system maintenance. " } elseif { $rewrite_response equals "3" } { HTTP::respond 200 content "Maintenance Access Maintenance Access Assistance Your IP Address is: [IP::client_addr] Please provide the IP Address listed above to the Support Team Representative assisting you with your maintenance window. This will allow the Representative to grant you override access to the maintenance page. Thank you. " } }
- steve_88008Nimbostratusso that is pretty tight script you have shared.. I can follow the logic on whats happening, but my tcl\irule chops are not even to a point where i could support that code.... thanks.
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