ltm rule command ifile
iRule(1) BIG-IP TMSH Manual iRule(1)
ifile
Returns content and attributes from external files on the BIG-IP
system.
SYNOPSIS
ifile 'listall'
ifile (
'get' |
'attributes' |
'last_updated_by' |
'revision' |
'size' |
'last_update_time'
)
IFILE_OBJ
DESCRIPTION
This iRules command returns content and attributes from external files
on the BIG-IP system
Syntax
ifile get
* returns the contents of the file
ifile listall
* returns a list of all iFiles available
ifile attributes
* returns all the attributes of an iFile
ifile size
* returns the size of an iFile
ifile last_updated_by
* returns the user who last update the iFile on the system
ifile last_update_time
* returns the date the iFile was last updated
ifile revision
* returns the current revision of the iFile
ifile checksum
* returns the checksum of the iFile
array set [ifile attributes ]
* stores all the iFile attributes for an iFile in an array
RETURN VALUE
VALID DURING
EXAMPLES
when RULE_INIT {
# Get a list of iFiles
# Waiting 10 seconds first to ensure they are fully defined after iFile loading is complete
after 10000 {
set ifilelist [ifile listall]
log local0. "List of files: $ifilelist"
# Print the attributes for the first iFile in the list
log local0. "Attributes for the first file [lindex $ifilelist 0]:"
array set ifile_attributes [ifile attributes [lindex $ifilelist 0]]
foreach {array attr} [array get ifile_attributes] {
log local0. "Array $array Attr: $attr"
}
unset ifilelist ifile_attributes array attr
}
}
when HTTP_REQUEST {
# Retrieve the file contents, send it in an HTTP 200 response and clear the temporary variable
set ifileContent [ifile get "/Common/iFile-index.html"]
HTTP::respond 200 content $ifileContent
unset ifileContent
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-11.1.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)