Automated backup F5 configuration to remote server

Problem this snippet solves:


I made simple script that auto backup SCF and UCF files to the remote server.

I read great article about autobackup based on the iApp (, but I wonder is that way to make it simplest. I don't think that my script is better, but only simple. This scritp based on TFTP communication so it isn't secure.

What you have to do is:

  1. Create a script file on every f5 and place it for example on directory /var/tmp/. I named file Change IP address TFTP_SERVER to your remote server

  2. Change mod of file to execute:

    chmod 755 ./

  3. Add line to the CRONTAB to run this script every X time

    Edit crontab:

    crontab -e

    Add line like this. Of course you can change the time when you want start script, it's only example:

    30 0 * * 6 /var/tmp/

That's all. I hope you enjoy this script.

I also wonder why f5 don't have native mechanism to auto backup on the remote server. It's the most basic function in other systems.

Code :

DATETIME="`date +%Y%m%d%H%M`"
cd ${OUT_DIR}
tmsh save /sys ucs "${OUT_DIR}/${FILE_UCS}"
tmsh save /sys config file "${OUT_DIR}/${FILE_SCF}" no-passphrase
tar -cf "${OUT_DIR}/${FILE_CERT}" /config/ssl
tftp $TFTP_SERVER <<-END 1>&2
mode binary
put ${FILE_UCS}
put ${FILE_SCF}
put ${FILE_CERT}
rm -f "${FILE_UCS}"
rm -f "${FILE_SCF}"
rm -f "${FILE_CERT}"
rm -f "${FILE_SCF}.tar"
exit $RTN_COD
Updated Jun 06, 2023
Version 2.0

Was this article helpful?