Forum Discussion

pdiab_72047's avatar
pdiab_72047
Icon for Nimbostratus rankNimbostratus
Oct 05, 2015

can I automate jobs using tmsh ?

i am looking to apply some irule ( maintenance page) on our external VIPs on the weekend and i want to automate this. Is there a way to use tmsh to apply irule on external VIP at a certain time( i want to automate the process like a cron job or something within tmsh) ? or can I use EM ? currently we are using 3rd party to push the config over the weekend but it is failing sometimes due to a 3rd party software issue. any suggesting is appreciated.

 

6 Replies

  • Hello,

    Using the Crontab is an option, but it has a drawback - if you upgrade the software, all Crontab config will be lost. Furthermore, Crontab resides outside TMOS, therefore any config in it will not be syncronized, and has to be managed separatelly on each HA cluster member.

    Note1: do not forget the "REMOTEUSER = root", otherwise you will not be able to issue TMSH commands from the Crontab!

    Note2: make sure you do not forget to include all the non-maintenance iRules (if you have any) since this TMSH command will replace all the existing rules with new ones. There's no "add/remove" option for the iRules in TMSH.

    You can use my sample below, tweak it as needed.

    crontab -e
    - opens the crontab config

    REMOTEUSER = root
    00 01 * * Sat tmsh modify ltm virtual MyVS rules { maintenance_irule another_irule } 
    adds the maintenance page iRule @ 01:00 system-time on every Saturday (1 hour after midnight)
    00 23 * * Sun tmsh modify ltm virtual MyVS rules { another_irule }
    removes the maintenance page iRule @ 23:00 system-time on every Sunday (1 hour before midnight)
    

    :wq
    - saves the crontab config

  • so applying the Sunday irlue all it does is remove the existing ones ? does rebooting the box cause the crontab to loose its config ? thanks for the prompt reply

     

  • never mind about this >> "so applying the Sunday irlue all it does is remove the existing ones " can you please answer this one though ? >> "does rebooting the box cause the crontab to loose its config ?" appreciate it !!

     

    • Hannes_Rapp's avatar
      Hannes_Rapp
      Icon for Nimbostratus rankNimbostratus
      Nope, that is given that you reboot to the same partition.
  • Hello, and what could be different way to automaticly run jobs instead of using crontab, for example I have implemmeted bunch of tmsh commands in crontab which sending for expample reports to my email (expiration of cert, status HA, etc), I am just curious about different ways (maybe will be better for administration and maintenance for me...).

     

    Thank you for hints AK