Forum Discussion

1 Reply

  • https://devcentral.f5.com/codeshare/time-based-irule-example

    when RULE_INIT {
    
        Start of maintenance window in YYYY-mm-dd HH:MM format
       set static::start_date "2016-05-29 18:45"
    
        End of maintenance window in YYYY-mm-dd HH:MM format
       set static::end_date "2017-05-29 18:45"
    
        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}{
          HTTP::respond 301 Location "https://domain.com/"
       }
        Default action is to use the virtual server default pool
    }