Forum Discussion
Automatic 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. Does someone have a working script?
Thanks
2 Replies
- Snl
Cirrostratus
Refer below sample
[root@TEST_F501:Active:In Sync] cron cd /var/
[root@TEST_F501:Active:In Sync] var pwd
/var
[root@TEST_F501:Active:In Sync] var crontab -l
cron tab for root1-59/30 * * * * /usr/bin/diskmonitor
block 395320*/1 * * * * /sbin/lsusb -v -d 0451:3410 >/dev/null
end 395320MAILTO="" 29 * * * * /usr/bin/copy_rrd save 0 1 * * * /var/tmp/ucsconf_backup/ucsconfbackup.sh [root@TEST_F501:Active:In Sync] var cd /var/tmp/ucsconf_backup/
[root@TEST_F501:Active:In Sync] ucsconf_backup ls TEST1f5_01conf.01Mar2015-0100.ucs
TEST1f5_01conf.25Feb2015-0100.ucs TEST1f5_01conf.28Feb2015-0100.ucs
[root@TEST_F501:Active:In Sync] ucsconf_backup cat ucsconfbackup.sh
!/bin/bash/usr/bin/tmsh save sys ucs /var/tmp/ucsconf_backup/TEST1f5_01conf.
date +%d%b%Y-%H%Mfind /var/tmp/ucsconf_backup/ -name "TEST1f5_01conf*" -a -mtime +6 -exec rm -rf {} \;
file=
find /var/tmp/ucsconf_backup -name "TEST1f5_01conf*" -a -mtime -1 | awk -F "/" '{print $5}'|xargsfor i in $file do
/usr/bin/scp /var/tmp/ucsconf_backup/$i f5sftp@192.168.20.15:F5_CONFIGBACKUP/TEST_F501/
done
[root@TEST_F501:Active:In Sync] ucsconf_backup
- tatmotiv
Cirrostratus
Here'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_dirHTH
Martin
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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