# Automated backup F5 configuration to remote server

**URL:** <https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901>\
**Category:** Community CodeShare\
**Tags:** big-ip\
**Created:** [June 8, 2018, 7:23pm UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901 "2018-06-08T19:23:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarloS1](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@CarloS1](https://community.f5.com/u/CarloS1)\
**Post date:** [June 8, 2018, 7:23pm UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/1 "2018-06-08T19:23:51Z")

</div>

**Problem this snippet solves:**

Hi,

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 ([https://devcentral.f5.com/codeshare/f5-iapp-automated-backup-1114](https://devcentral.f5.com/codeshare/f5-iapp-automated-backup-1114)), 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 script\_backup.sh. Change IP address TFTP\_SERVER to your remote server

2. Change mod of file to execute:

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

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 :**

```auto
TFTP_SERVER=10.0.0.0
DATETIME="`date +%Y%m%d%H%M`"
OUT_DIR='/var/tmp'
FILE_UCS="f5_lan_${HOSTNAME}.ucs"
FILE_SCF="f5_lan_${HOSTNAME}.scf"
FILE_CERT="f5_lan_${HOSTNAME}.cert.tar"
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}
quit
END
rm -f "${FILE_UCS}"
rm -f "${FILE_SCF}"
rm -f "${FILE_CERT}"
rm -f "${FILE_SCF}.tar"
RTN_CODE=$?
exit $RTN_COD

```

---

<div class="post-metadata">

**Author:** ![David\_Willman](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@David\_Willman](https://community.f5.com/u/David_Willman)\
**Post date:** [July 18, 2019, 4:15pm UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/2 "2019-07-18T16:15:44Z")

</div>

The reason there is no auto backup function on a BIG-IP is because that function is done via BIG-IQ Central Management.

---

<div class="post-metadata">

**Author:** ![Ndlovumm](https://avatars.discourse-cdn.com/v4/letter/n/958977/32.png) [@Ndlovumm](https://community.f5.com/u/Ndlovumm)\
**Post date:** [July 31, 2020, 2:25pm UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/3 "2020-07-31T14:25:10Z")

</div>

Where in the tftp server does the script save the backups? I applied the scrip but it doesnt seem to be working

---

<div class="post-metadata">

**Author:** ![Madharasan\_Vict](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@Madharasan\_Vict](https://community.f5.com/u/Madharasan_Vict)\
**Post date:** [July 31, 2020, 8:30pm UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/4 "2020-07-31T20:30:41Z")

</div>

One modification required on script

RTN\_CODE=$?

exit $RTN\_COD

RTN\_CODE=$?

exit $RTN\_CODE

---

<div class="post-metadata">

**Author:** ![Alex\_Madjeski](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alex\_Madjeski](https://community.f5.com/u/Alex_Madjeski)\
**Post date:** [May 16, 2024, 7:40am UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/5 "2024-05-16T07:40:09Z")

</div>

Thank you for sharing this.

How can I modify this script to use SCP?

---

<div class="post-metadata">

**Author:** ![P\_Kueppers](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/p_kueppers/32/22789_2.png) [@P\_Kueppers](https://community.f5.com/u/P_Kueppers)\
**Post date:** [May 16, 2024, 8:06am UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/6 "2024-05-16T08:06:43Z")

</div>

Is there any reason not using this?

[Archiving UCS files using the logrotate and crontab utilities (11.x - 17.x) (f5.com)](https://my.f5.com/manage/s/article/K13418)

@Alex: Take a look - This is what Im using for backup per scp to remote

---

<div class="post-metadata">

**Author:** ![Alex\_Madjeski](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alex\_Madjeski](https://community.f5.com/u/Alex_Madjeski)\
**Post date:** [May 16, 2024, 9:07am UTC](https://community.f5.com/t/automated-backup-f5-configuration-to-remote-server/67901/7 "2024-05-16T09:07:12Z")

</div>

@P_Kueppers Thank you for such a quick response!&nbsp; It would be easier to use the TFTP but policy mandates to do it by secure means.
