iCall script to "save sys config" only when changes are detected
Problem this snippet solves:
This script will check to see if configuration changes have occurred every X seconds, and if so, will issue the "save sys config" command via TMSH. This is helpful for auto-saving functionality, especially when you are using iControl REST in a dynamic environment and don't want to issue multiple "save sys config" commands via the API for each call.
How to use this snippet:
Create the script and the handler and you're up and running! The interval in the handler is the number of seconds between checks.
Code :
sys icall script /Common/F5.SaveConfig.OnlyIfModified {
app-service none
definition {
set dbfile_timestamp [exec stat /config/BigDB.dat --format %Z]
set conffile_timestamp [exec stat /config/bigip.conf --format %Z]
if { $dbfile_timestamp > $conffile_timestamp } {
tmsh::save sys config partitions all
}
}
description none
events none
}
sys icall handler periodic /Common/F5.AutoSaveConfigScheduledTask {
interval 120
script /Common/F5.SaveConfig.OnlyIfModified
}Tested this on version:
12.1Published Aug 13, 2019
Version 1.0G-Rob
Employee
F5 Solutions Engineer focused on cloud, automation, modern apps and excellent customer-focused service.G-Rob
Employee
F5 Solutions Engineer focused on cloud, automation, modern apps and excellent customer-focused service.No CommentsBe the first to comment