Forum Discussion
iRule to read dynamic file in /tmp/ location
Hi All, I've been trying to figure out if there is a way for an iRule to read from a file located in the /tmp/ directory on itself (LTM). The reason for this is I have a script running as a cronjob on the LTM to generate a unique string that I want to be able to manipulate and use in this iRule.
So in summary, can an irule read from a location on the itself(LTM) and store it as a string?
Thanks!
3 Replies
- Michael_Jenkins
Cirrostratus
Maybe someone can correct me if I'm wrong, but I'm pretty sure you can't access the file system through an iRule.
As a possible way around that, you could set your cron job up to run a
command to update atmsh
with your unique string. Then your iRule could read the string from the data group (I don't believe you can update a data group record within an iRule though).data group
Hope this helps.
- Hannes_Rapp
Nimbostratus
Unfortunately, not possible at this point. TMOS and the underlying RHEL are kept separated on purpose. You can circumvent that since v11.4 (iCall). iRule calls the iCall -> iCall calls the TCL script -> TCL script interacts with the file in /tmp/ location. Can be a bit complicated if it's your first time doing a workaround like this, suggest to decomission your idea :)
- Michael_Jenkins
Cirrostratus
Tried to update my original answer, but it wouldn't save, so here's the idea.
You can use the following commands to work with data groups from the command line:
CREATE tmsh create / ltm data-group internal TEST_DATA_GROUP records add { MyKey { data MyValue } } type string MODIFY tmsh modify / ltm data-group internal TEST_DATA_GROUP records replace-all-with { MyKey2 { data MyValue2 } } LIST tmsh list / ltm data-group internal TEST_DATA_GROUP
In your iRule, you could grab the value like this
set myval [class match -value "MyKey" equals TEST_DATA_GROUP]
Recent Discussions
Related Content
* 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