Forum Discussion
Gordon_Johnston
Oct 16, 2005Nimbostratus
Date/Time sensitive iRules
Another question if I may.
How can I query the current time of day with an iRule. I'd like an iRule to apply at only certain times of the day, and rather than writing cron entries to update the config (ugly) I'd like to do this with the iRule itself. Is this possible? Can you point me in the way of some documentation, I couldn't find anything relevent.
Cheers
- Brian_Gupta_115NimbostratusHave you considered writing iControl external scripts to make these config changes... You'd still need a scheduler to trigger the scripts, but at least you'd be using their API.
- JRahmAdminuse the clock command: http://tmml.sourceforge.net/doc/tcl/clock.html
set curtime [clock seconds] set formattedtime [clock format $curtime] log "$curtime seconds since epoch, $formattedtime"
- JRahmAdminIf you only want to return hours and minutes for easier evaluation, change the format line to read:
set formattedtime [clock format $curtime -format {%H:%S} ]
- Gordon_JohnstonNimbostratusExcellent the formatted output from clock is exactly what's needed. Thanks.
- Ninjai_DI_67376Nimbostratus
set formated_time [clock format $time_now -format {%Y-%m-%d %H:%M:%S}]
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