Forum Discussion

Preet_pk's avatar
Preet_pk
Icon for Cirrus rankCirrus
Sep 25, 2023

Schedule automatic UCS F5 backup

Hi,

I want to auto schedule F5 UCS backup. Please share the steps to configure scheduled auto backup in F5.

  • Hello,

    What I do nightly (via cron) is create a UCS backup file and then send my backup to a remote file server.  I have a couple of devices so I make the UCS backup file have the name of the device.

    backup_config.sh

    #/bin/sh

    HOST=`echo $HOSTNAME | awk -F . '{print $1}'`
    CONFILE=`echo /shared/tmp/$HOST.ucs`
    tmsh -c "save sys ucs $CONFILE"
    /usr/bin/scp $CONFILE <username>@<IP of backup server>:/<backup_directory>

    crontab

    35 23 * * * /root/backup.sh 2>&1 > /dev/null

    Normally the UCS file is written to /var/local/ucs but my config files are large so there is not always room in that directory so I write them to /shared/tmp instead.  If your configs are smaller you would not need to do that.  If they are small and you want to keep multiple on box then I would add a date to the filename in the script above but then you will also have to prune them after your retention date.

    There is more in my backup script to send copies of other files for off box retention and adding them to our Rancid repository.

    Please note if you add this to the root crontab then you will have to re-add it each time you upgrade since the upgrade overwrites the root crontab file.