Forum Discussion

F5Zan_89516's avatar
F5Zan_89516
Icon for Nimbostratus rankNimbostratus
Oct 15, 2013

Scheduled Automatic Backup of LTM's

I am after a script either in powerhsell or F5 scipting which can create a UCS file daily and then copy it to a centralized location for 5 days Any help or guidance would be appreciated

 

8 Replies

  • Have you checked out: https://devcentral.f5.com/s/articles/icontrol-apps-06-configuration-archiving
  • Here are others

     

    https://devcentral.f5.com/wiki/advdesignconfig.BIG-IP-10-2-backup-script-with-SCP-transfer.ashx

     

    https://devcentral.f5.com/wiki/iapp.configuration_backup_scheduler_v11_2.ashx

     

    https://devcentral.f5.com/wiki/AdvDesignConfig.LTM_Backup_Shell_Script.ashx

     

    I hope this helps

     

    -=Bhattman=-

     

  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus

    I run a perl script from cron, which uses SSH to run a bash script on the remote F5 to create a UCS backup, then SCP to copy the UCS off.

    Here's a simplified version of my script:

    !/usr/bin/perl
    
    $ip = 10.1.2.3;
    $hostname = "myF5";
    
    $remotefile = "/var/tmp/backup.ucs";
    $localfile =  "/backup/$hostname.ucs";
    
    $cmd = << CMD;
    if [ -n "`file -L /bin/bigpipe|grep text`" ]; then
       tmsh save /sys ucs $remotefile 2>/dev/null
    else
       bigpipe config save $remotefile 2>/dev/null
    fi
    CMD
    
    open SSH, "| /usr/bin/ssh -q -T -o \"ConnectTimeout 10\" -l root $ip";
    print SSH "$cmd";
    close SSH;
    if ($? != 0) {
        die "SSH to $hostname failed with $?\n";
    }
    
    system("$scp -o \"ConnectTimeout 10\" root\@$ip:$remotefile $localfile 2>/dev/null");
    if ($? != 0) {
           die "SCP to $hostname failed with $?\n";
    }
    
    • F5Zan_89516's avatar
      F5Zan_89516
      Icon for Nimbostratus rankNimbostratus
      Thanks uni, can you let me know how you have configured it to run as a scheduled task? And what if i want to save it on some smb share for a week and then delete the older ones... I am a windows guy , not much idea on Linux systems :-)
  • I run a perl script from cron, which uses SSH to run a bash script on the remote F5 to create a UCS backup, then SCP to copy the UCS off.

    Here's a simplified version of my script:

    !/usr/bin/perl
    
    $ip = 10.1.2.3;
    $hostname = "myF5";
    
    $remotefile = "/var/tmp/backup.ucs";
    $localfile =  "/backup/$hostname.ucs";
    
    $cmd = << CMD;
    if [ -n "`file -L /bin/bigpipe|grep text`" ]; then
       tmsh save /sys ucs $remotefile 2>/dev/null
    else
       bigpipe config save $remotefile 2>/dev/null
    fi
    CMD
    
    open SSH, "| /usr/bin/ssh -q -T -o \"ConnectTimeout 10\" -l root $ip";
    print SSH "$cmd";
    close SSH;
    if ($? != 0) {
        die "SSH to $hostname failed with $?\n";
    }
    
    system("$scp -o \"ConnectTimeout 10\" root\@$ip:$remotefile $localfile 2>/dev/null");
    if ($? != 0) {
           die "SCP to $hostname failed with $?\n";
    }
    
    • F5Zan_89516's avatar
      F5Zan_89516
      Icon for Nimbostratus rankNimbostratus
      Thanks uni, can you let me know how you have configured it to run as a scheduled task? And what if i want to save it on some smb share for a week and then delete the older ones... I am a windows guy , not much idea on Linux systems :-)