Forum Discussion

Senthil_7991's avatar
Senthil_7991
Icon for Nimbostratus rankNimbostratus
Jan 03, 2018

Schedule Auto Backup of LTM UCS

Hi Team,

 

We would like to schedule auto backup of our LTM UCS file to local computer, please let us know to how to do?

 

Running Version BIG-IP 11.6.1 Build 1.0.326 Hotfix HF1

 

7 Replies

  • There are many ways to take F5 backup regularly or based on time frame. Either go via some script(bash, perl,etc) or existing iAPP setup. Its up to your choice how you gonna to make it.

    Option1: Bash Script

    Its via SFTP and key authentication. You need to first create a

    dsa key
    to use for authentication to your SCP/SFTP server. Then put the script in a file named /config/backup and create a chron job using this,
    chmod +x /config/backup; ln -s /config/backup /etc/cron.daily/backup

    !/bin/bash
    
     Set variables for UCS file name 
    dt=`date +%Y%m%d`
    hostname=`uname -n |cut -d. -f1`
    DDIR=/var/tmp
    SFTPhost=
    
     Delete old ucs file created by this script 
    rm $DDIR/$hostname*.ucs
    cd /config
    tmsh save /sys config
     Create configuraiton archive 
    tmsh save /sys ucs $DDIR/$hostname-$dt.ucs
     Send to admin server via SFTP 
    cd $DDIR
    sftp -oIdentityFile=/config/sftp_dsa $hostname@$SFTPhost<< EOF
    cd $hostname
    put $hostname-$dt.ucs
    quit
    EOF
    

    Option 2(via iApp) Please go through below link

    • Senthil_7991's avatar
      Senthil_7991
      Icon for Nimbostratus rankNimbostratus

      Hi Team, I would know where should put my username/ password details for SFTP, Please explain some more clearly.

      I created this below script and put inside but having issue

      !/bin/bash

      $DATE=

      date +%Y%m%d
      hostname=
      uname -n |cut -d. -f1

      Here we create the ucs archive

      tmsh save sys ucs $DATE

      Here we do the same with ftp

      ftp -n xx.xx.xx.xx

      user xxxxxx "xxxxx" binary cd \Users\xxxxx\Desktop\Newfolder put "$DATE.ucs" bye End-Of-Session

      Getting this below error

      ++ date +%Y%m%d + =20180109 f5backup.sh: line 2: =20180109: command not found ++ uname -n ++ cut -d. -f1 + hostname=XXXXXXXXXX + tmsh save sys ucs Syntax Error: enter ucs identifier + ftp -n XXXXXXX

      ^C+ user XXXXXX XXXXXX f5backup.sh: line 11: user: command not found + binary f5backup.sh: line 12: binary: command not found + cd UsersxxxxxxxDesktopNewfolder f5backup.sh: line 13: cd: UsersxxxxxxxxDesktopNewfolder: No such file or directory + put .ucs f5backup.sh: line 14: put: command not found + bye f5backup.sh: line 15: bye: command not found + End-Of-Session f5backup.sh: line 16: End-Of-Session: command not found

  • DATE=date +%Y%m%d

     

    hostname=uname -n |cut -d. -f1

     

    tmsh save sys ucs $DATE

     

    sleep 5

     

    ftp -n xx.xx.xx.xx << EOF

     

    user xxxxxx "xxxxx"

     

    binary

     

    cd \Users\xxxxx\Desktop\Newfolder

     

    put "$DATE.ucs"

     

    bye

     

    End-Of-Session

     

    EOF

     

    • Senthil_7991's avatar
      Senthil_7991
      Icon for Nimbostratus rankNimbostratus

      Still, am having same issue, Please explain step by step.

       

      Active:In Sync] tmp bash -x f5backup.sh

       

      • =date +%Y%m%d f5backup.sh: line 2: =date: command not found
      • hostname=uname
      • -n
      • cut -d. -f1 f5backup.sh: line 3: -n: command not found
      • tmsh save sys ucs Syntax Error: enter ucs identifier
      • ftp -n xx.xx.xx.xx

      ^C+ user xxxxxx xxxxxxx f5backup.sh: line 11: user: command not found + binary f5backup.sh: line 12: binary: command not found + cd usersxxxxxxdesktopnewfolder f5backup.sh: line 13: cd: usersxxxxxxdesktopnewfolder: No such file or directory + put .ucs f5backup.sh: line 14: put: command not found + bye f5backup.sh: line 15: bye: command not found + End-Of-Session f5backup.sh: line 16: End-Of-Session: command not found Active:In Sync] tmp

       

      Active:In Sync] tmp chmod +x f5backup.sh Active:In Sync] tmp ./f5backup.sh ./f5backup.sh: line 2: +%Y%m%d: command not found ./f5backup.sh: line 3: -n: command not found Syntax Error: enter ucs identifier ^C./f5backup.sh: line 11: user: command not found ./f5backup.sh: line 12: binary: command not found ./f5backup.sh: line 13: cd: usersxxxxxdesktopnewfolder: No such file or directory ./f5backup.sh: line 14: put: command not found ./f5backup.sh: line 15: bye: command not found ./f5backup.sh: line 16: End-Of-Session: command not found Active:In Sync] tmp Active:In Sync] tmp

       

  • I modified the script to transfer the file to our SFTP server and it worked but how do I get it to send the password for the user I created on the SFTP server?

     

    [root@CMWF5V01P:Active:In Sync] config ./backup.sh Saving running configuration... /config/bigip.conf /config/bigip_base.conf /config/bigip_user.conf Saving Ethernet mapping...done Saving active configuration... /var/tmp/CMWF5V01P-20181030.ucs is saved. Connecting to 10.100.1.251... CMWF5V01P@10.100.1.251's password: