Mar 27, 2026 - For details about updated CVE-2025-53521 (BIG-IP APM vulnerability), refer to K000156741.

Forum Discussion

Brad_146558's avatar
Brad_146558
Icon for Nimbostratus rankNimbostratus
Oct 18, 2016

Time based iRule question

Hi everyone,

I'm writing an iRule that triggers a daily maintenance page. I'm trying to get this page to come up between two certain time periods each and every day. I used an iRule I'd found in an article from hoolio as I'd never done a time based iRule before. I'm running into an error that I posted just below the iRule. I'm thinking that I'm receiving this because I don't have the appropriate wild cards in for the dates. Any help would be appreciated! 😃

    when RULE_INIT {

    Start of maintenance window in YYYY-mm-dd HH:MM format
   set static::start_date "11:00"

    End of maintenance window in YYYY-mm-dd HH:MM format
   set static::end_date "5:00"

    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 {

    Get the current time in seconds since the Unix epoch of 0-0-1970
   set now [clock seconds]
    Check if the current time is between the start and end times
   if {$now > $static::start and $now < $static::end}{
      pool my_maintenance_pool
   }
    Default action is to use the virtual server default pool
}

 - can't read "static::end": no such variable     while executing "if {$now >$static::start and $now < $static::end}{       pool my_maintenance_pool    }"

2 Replies

  • Hi,

    look at this irule to change action based on time and week day:

    https://devcentral.f5.com/questions/irule-to-block-access-of-vs-on-specific-days

    clock scan commands must not be executed in RULE_INIT event if only hour is set. it will convert hour from the day you last loaded the irule.

    if today, you load the irule with set

    static::start [clock scan "5:00"]
    , it will not work for next days but only for today.

    If you want for every days, use a variable in CLIENT_ACCEPTED and not a static variable in RULE_INIT