Forum Discussion
Schedule automatic UCS F5 backup
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.
- Nikoolayy1Sep 25, 2023MVP
That is a great solution but for the scheduling better use icall than cronjob as it will stay there even after tmos upgrade.
https://community.f5.com/t5/technical-articles/what-is-icall/ta-p/288206
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com