F5 Sites
  • F5.com
  • LearnF5
  • NGINX
  • MyF5
  • Partner Central
Contact
  • Under Attack?
  • F5 Support
  • DevCentral Support
  • F5 Sales
  • NGINX Sales
  • F5 Professional Services
Skip to contentBrand Logo
Forums
CrowdSRC
Articles
Groups
EventsSuggestionsHow Do I...?
RegisterSign In
  1. DevCentral
  2. Articles
  3. Technical Articles

iRule Maintenance Windows

A fun, but not well known, feature on BIG-IP is the Statistics Profile. This tech tip is the second in a series on how the Statistics Profile and iRules, when working together, can save time, product...
Published Apr 10, 2007
Version 1.0
automation
BIG-IP
dev
management
monitoring
news
tech tip
virtualization
Joe_Pruitt's avatar
Joe_Pruitt
Joined September 22, 2004
View Profile
Joe_Pruitt's avatar
Joe_Pruitt
Joined September 22, 2004
View Profile
DeVon_Jarvis's avatar
DeVon_Jarvis
Icon for Altostratus rankAltostratus
Nov 10, 2008
I tried to use part of this code to create an static outage window iRule this weekend. The problem is, there is a bug in this code.

 

 

When this line executes:

 

set cur_time [expr [expr [lindex $l 1]*100] + [lindex $l 2]]

 

 

It fails if the hour or minute is 08 or 09. The problem is, TCL assumes any string that starts with a '0' is octal, and 08 and 09 are invalid octal strings!

 

 

There are 2 options. Either use string manipulation or regexp to trim the zeros. I chose the string manipulation, thinking it would be faster. I didn't time it out though...

 

 

Here is the "fixed" code:

 

set cur_day [lindex $t_array 0]

 

set cur_hour [string trimleft [lindex $t_array 1] 0]

 

if { ![string length $cur_hour] } { set cur_hour 0 }

 

set cur_min [string trimleft [lindex $t_array 2] 0]

 

if { ![string length $cur_min] } { set cur_min 0 }

 

set cur_time [expr ( $cur_hour * 100 ) + $cur_min]

 

 

 

Hope this helps someone out there!

ABOUT DEVCENTRAL

DevCentral NewsTechnical ForumTechnical ArticlesTechnical CrowdSRCCommunity GuidelinesDevCentral EULAGet a Developer Lab LicenseBecome a DevCentral MVP

RESOURCES

Product DocumentationWhite PapersGlossaryCustomer StoriesWebinarsFree Online CoursesF5 CertificationLearnF5 Training

SUPPORT

Manage SubscriptionsProfessional ServicesProfessional ServicesCreate a Service RequestSoftware DownloadsSupport Portal

PARTNERS

Find a Reseller PartnerTechnology AlliancesBecome an F5 PartnerLogin to Partner Central

F5 logo©2024 F5, Inc. All rights reserved.
TrademarksPoliciesPrivacyCalifornia PrivacyDo Not Sell My Personal Information