Forum Discussion
iRules are connection based, meaning they are triggered in response to a connection, not at a scheduled time. Having said that, you could have the iRules configured on the BIG-IP system but not assigned to the virtual server. Then you can use an automated script that runs at the start of a time period to assign the iRule to the virtual server, and runs again at the end of the time period to remove the iRule from the virtual server. (iControl REST API is perfect for this.)
The only way I can think of to actually control the timing from within the iRule is for it to check the current time (clock) at every HTTP_REQUEST event, then exit the iRule (return) if the current time is not within the desired window. That seems like a lot of unnecessary overhead though since, more often than not, the event is triggered at a point that is not within one of those scheduled time periods, but still has to go through the motions of checking the time.
As an aside, you can do what your iRules do with a local traffic policy, which is more efficient. Your automated script can assign and remove the policy as easily as it can the iRule.