Forum Discussion
Nuruddin_Ahmed_
Cirrostratus
Jun 23, 2016Automatic Backup for LTM+ASM+APM
Hi,
I have been trying to make automatic backup work for our LTM+ASM+APM box which is running on 11.6.0 HF6. We tried some of the scripts which are available on devcentral but they did not work....
tatmotiv
Cirrostratus
Jun 23, 2016Here's another version. That one will generate a plain-text .scf (for grepping things), a tarred .scf (for archiving) and an .ucs archive (for backup/restore) and upload all of them to an scp remote server. Locally (in shared/backups/), files of the last 14 days are kept. Just put this script into /etc/cron.daily and make it executable. Please note that you will need to reinstall both script and ssh key after system upgrades!
!/bin/bash
adapt variable settings here
local_dir=/shared/backup
remote_ip=1.2.3.4
remote_user=my_upload_user
remote_dir=/some/path/to/backups
ssh_key=/config/ssh/my_secret_private.key
do not change anything below
datestring=$(date +%Y_%m_%d_%H_%M_%S)
hoststring=$(tmsh list sys global-settings hostname | grep hostname | awk '{print $2}' | awk -F'.' '{print $1}')
scffilename=$hoststring"_"$datestring"_backup.scf"
ucsfilename=$hoststring"_"$datestring"_backup.ucs"
scffilecompletepath=$local_dir"/"$scffilename
ucsfilecompletepath=$local_dir"/"$ucsfilename
test -d $local_dir || mkdir $local_dir
tmsh save sys config
tmsh save sys config file $scffilecompletepath
tmsh save sys ucs $ucsfilecompletepath
find $local_dir -mtime +14 -delete
scp -i $ssh_key $scffilecompletepath $remote_user@$remote_ip:$remote_dir
scp -i $ssh_key $scffilecompletepath".tar" $remote_user@$remote_ip:$remote_dir
scp -i $ssh_key $ucsfilecompletepath $remote_user@$remote_ip:$remote_dir
HTH
Martin
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects