Forum Discussion

swo0sh_gt_13163's avatar
swo0sh_gt_13163
Icon for Altostratus rankAltostratus
Jul 20, 2014

F5 Auto backup script for SCP for V10 and 11.

Hello Guys,

 

I have tried looking for the subjected topic within DevCentral, but unfortunately that didn't help. (I must be doing something wrong for sure). By the way I couldn't find any script for SCP which can be use for version 10.

 

My requirement is to craft a script for SCP server which executes on daily basis. The customer is having 2 separate clusters, one is running on v10, another on 11.

 

Is there any script which I can use for my requirement?

 

Thank you,

 

  • Sure, I will. However can I use the same script for V10? It doesn't seem to be working with version 10, as it contains tmsh commands, right?

     

    Can you please share the same script for V10?

     

    Cheers!

     

  • tmsh is supported in v10 so shouldn't be a problem.

     

    If you think it is I'd suggest you enter each command manually at the CLI and see which one is the problem. The syntax may have changed slightly between versions perhaps? There are only two so this shouldn't take long. I don't have v10 to test against unfortunately.

     

  • Hi All!

    Thank you very much guys for your help. I have successfully achieved the requirement!!!

    I have managed to transfer backup to the SCP server. Following is the final version of the script which made it working.

    !/bin/bash
    /admin/home/bigipbackup.sh
    
    UCS Files will be saved to /var/local/ucs/
    SCF Files will be saved to /var/local/scf/
    
    Create current date/time stamp variable
    DATETIME="`date +%Y_%m_%d`"
    Note the correct ` character must be used above,
    this can be found near the top left of most keyboards
    just under the [ESCAPE] key.
    
    Uncomment the following line for troubleshooting
    echo $DATETIME
    
    Create filename variable
    UCS_FILENAME="${DATETIME}_$HOSTNAME"
    
    Uncomment the following line for troubleshooting
    echo $UCS_FILENAME
    
    Create a UCS archive with the filename specified above
    The file extension will be .ucs � will be available in the GUI
    tmsh save sys ucs "${UCS_FILENAME}"
    
    Also create an SCF file with the same filename
    The file extension will be .scf � won�t be available in the GUI
    tmsh save sys config file "${UCS_FILENAME}.scf"
    
    If you don�t delete these files /var will become full fairly quickly
    Change the +31 value (31 days) to whatever suits you
    find /var/local/ucs/ �mtime 21 -delete
    
    scp "/var/local/ucs/${UCS_FILENAME}.ucs" f5-user@10.254.55.22:/home/f5-user/tmp/S1DZILB01/
    EOF
    

    Without defining the source and destination complete path, it was giving different errors. Many thanks for sharing the script, that really helped.

    Cheers!

    • What_Lies_Bene1's avatar
      What_Lies_Bene1
      Icon for Cirrostratus rankCirrostratus
      Good news, you're right about the source path, I'll know for next time. Cheers
  • Soon I will share complete steps I have followed to achieve the Backup Automation. That might help someone.

     

    Cheers!

     

  • Hi All!

     

    I have prepared a raw document, which covers all the procedures need to configure on SCP/BigIP in order to achieve the objective.

     

    As it is very raw, any help improving the doc, would help others to achieve their requirement.

     

    https://www.dropbox.com/s/muasd5t8mu7wu4o/F5%20Backup%20procedure%20over%20SCP.docx

     

    In case if you modify the doc, please upload it somewhere and share the link as well.

     

    Thank you very much you all to achieve my objective. Much appreciated!

     

    Cheers!

     

    • Jeff_Hollenshea's avatar
      Jeff_Hollenshea
      Icon for Nimbostratus rankNimbostratus
      Hi, I am trying to do the opposite in a way. I want to SCP to a F5 create the latest .ucs file and then pull it back to the scp server. So basically I want the SCP server to do all commands. This will be done to multiple F5's so the name of the file needs to keep the same date and hostname as the file generated in var/tmp on that specific device. Thanks