Have some code. Share some code.
Showing results for 
Search instead for 
Did you mean: 
F5 Employee
F5 Employee

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:

Version history
Last update:
‎13-Aug-2019 05:54
Updated by: