Forum Discussion
Backup script for F5 LTM and FTP the UCS off to another server
I am trying to automate backups on my F5 LTMs. I have downloaded the following script and tried to run it. For Version 11.x branch https://devcentral.f5.com/wiki/AdvDesignConfig.LTM_Backup_Shell_Script.ashx But it keeps throwing errors
With version 10 backup script the bagpipe backup script worked fine. Now that we are running v11 I can't seem to get it to run. Any assistance would be appreciated.
14 Replies
it might help if you tell which errors you get, have you set all variables correctly?
- nitass
Employee
But it keeps throwing errors
what is the error message?
- What_Lies_Bene1
Cirrostratus
Can you provide some information on the errors please? Perhaps you have an old version that contains bigpipe commands?
- What_Lies_Bene1
Cirrostratus
Are the HTML tags in your script or is that just something DC has added? If they are in your script I'd suggest you copy and paste the script from the website again in a way that doesn't include the tags.
- nitass
Employee
this is mine.
bigip [root@ve11a:Standby:Not All Devices Synced] config /var/tmp/backup_cron_scriptv11.sh + tmsh save /sys ucs /var/tmp/BIG-IP_backup Saving active configuration... /var/tmp/BIG-IP_backup.ucs is saved. ++ date +%y%m%d + export a=130905 + a=130905 + export aa=ve11a.acme.com.130905.ucs + aa=ve11a.acme.com.130905.ucs + export b=/var/tmp/ve11a.acme.com.130905.ucs + b=/var/tmp/ve11a.acme.com.130905.ucs + mv /var/tmp/BIG-IP_backup.ucs /var/tmp/ve11a.acme.com.130905.ucs + tar -cf /var/tmp/certs.tar /config/ssl tar: Removing leading `/' from member names + export ff=ve11a.acme.com.130905.certs.tar + ff=ve11a.acme.com.130905.certs.tar + export f=/var/tmp/ve11a.acme.com.130905.certs.tar + f=/var/tmp/ve11a.acme.com.130905.certs.tar + mv /var/tmp/certs.tar /var/tmp/ve11a.acme.com.130905.certs.tar + export c=ve11a.acme.com.130905.crontab + c=ve11a.acme.com.130905.crontab + export cc=/var/tmp/ve11a.acme.com.130905.crontab + cc=/var/tmp/ve11a.acme.com.130905.crontab + cp /etc/crontab /var/tmp/ve11a.acme.com.130905.crontab + export MName=200.200.200.101 + MName=200.200.200.101 + export Log=/var/tmp/log.bigip + Log=/var/tmp/log.bigip + export UserName=root + UserName=root + export UserPassword=password + UserPassword=password + export Machine1f2=ve11a.acme.com.130905.ucs + Machine1f2=ve11a.acme.com.130905.ucs + export Machine1f3=ve11a.acme.com.130905.crontab + Machine1f3=ve11a.acme.com.130905.crontab + export Machine1f4=ve11a.acme.com.130905.certs.tar + Machine1f4=ve11a.acme.com.130905.certs.tar + ftp -nvd 200.200.200.101 + rm -f /var/tmp/ve11a.acme.com.130905.ucs + rm -f /var/tmp/ve11a.acme.com.130905.crontab + rm -f /var/tmp/ve11a.acme.com.130905.certs.tar + RTN_CODE=0 + exit 0 ftpd [root@centos101 ~] ls -l ve* -rw-r--r-- 1 root root 1679360 Sep 5 01:39 ve11a.acme.com.130905.certs.tar -rw-r--r-- 1 root root 253 Sep 5 01:39 ve11a.acme.com.130905.crontab -rw-r--r-- 1 root root 732092 Sep 5 01:39 ve11a.acme.com.130905.ucs - JRahm
Admin
Backups are much simplified in 11.4 with the introduction of iCall. I wrote up an iCall-based backup solution a while back, and the iApp template here in the wiki.
- Stephen_Spence_
Nimbostratus
I think the problem that I am having might have to do with the fact I am possibly not running the script as the root account. The tmsh save /sys ucs /var/tmp/BIG-IP_backup command won't run from the command line unless I give the tmsh command first. I copied the script into the etc/cron.daily and have been running it manually to see if it works.
- Stephen_Spence_
Nimbostratus
The problem with the script file was it contained carriage returns. I removed them and the script appears to run...but it is now prompting for a password.
If I enter the FTP password I then get failed login.
If I use the FTP command from the command line and enter in the username and password it connects to the remote server without an issue.
does your username or password contain any special characters that might cause issues? you could try with a simple username / password (just letters) first to check if it does.
- Stephen_Spence_
Nimbostratus
Here is the code:
!/bin/sh -x Name: backup_cron_scriptv11.sh BIG-IP Backup Script This script automates LTM v11 Backups and saves the files with hostname and date off to an FTP server version 1.0 Author: Bhattman Original Date: 01/07/10 Modified by Yih Wen 30/11/12 tmsh save /sys ucs /var/tmp/BIG-IP_backup export a=date +"%y%m%d" export aa=$HOSTNAME.$a.ucs export b=/var/tmp/$aa mv /var/tmp/BIG-IP_backup.ucs $b tar -cf /var/tmp/certs.tar /config/ssl export ff=$HOSTNAME.$a.certs.tar export f=/var/tmp/$ff mv /var/tmp/certs.tar $f Added By Ed Elias 11/26/02 export c=$HOSTNAME.$a.crontab export cc=/var/tmp/$c cp /etc/crontab $cc export MName=192.168.10.10 export Log=/var/tmp/log.bigip export UserName=testuser export UserPassword=testpassword Added and Updated by Ed Elias 11/14/07 export Machine1f2=$aa export Machine1f3=$c export Machine1f4=$ff ftp -nvd ${MName} <<-END 1>&2 > ${Log} user ${UserName} ${UserPassword} bin put ${b} ${Machine1f2} put ${cc} ${Machine1f3} put ${f} ${Machine1f4} quit END rm -f ${b} rm -f ${cc} rm -f ${f} RTN_CODE=$? exit $RTN_CODE Here is what I am seeing: [testuser@F5:Active:In Sync] cron.daily sh -x ./f5backupv11.sh + tmsh save /sys ucs /var/tmp/BIG-IP_backup Saving active configuration... /var/tmp/BIG-IP_backup.ucs is saved. ++ date +%y%m%d + export a=130909 + a=130909 + export aa=f5.test.com.130909.ucs + aa=f5.test.com.130909.ucs + export b=/var/tmp/f5.test.com.130909.ucs + b=/var/tmp/f5.test.com.130909.ucs + mv /var/tmp/BIG-IP_backup.ucs /var/tmp/f5.test.com.130909.ucs + tar -cf /var/tmp/certs.tar /config/ssl tar: Removing leading `/' from member names + export ff=f5.test.com.130909.certs.tar + ff=f5.test.com.130909.certs.tar + export f=/var/tmp/f5.test.com.130909.certs.tar + f=/var/tmp/f5.test.com.130909.certs.tar + mv /var/tmp/certs.tar /var/tmp/f5.test.com.130909.certs.tar + export c=f5.test.com.130909.crontab + c=f5.test.com.130909.crontab + export cc=/var/tmp/f5.test.com.130909.crontab + cc=/var/tmp/f5.test.com.130909.crontab + cp /etc/crontab /var/tmp/f5.test.com.130909.crontab + export MName=192.168.10.10 + MName=192.168.10.10 + export Log=/var/tmp/log.bigip + Log=/var/tmp/log.bigip + export UserName=testuser + UserName=testuser + export UserPassword=testpassword + UserPassword=testpassword + export Machine1f2=f5.test.com.130909.ucs + Machine1f2=f5.test.com.130909.ucs + export Machine1f3=f5.test.com.130909.crontab + Machine1f3=f5.test.com.130909.crontab + export Machine1f4=f5.test.com.130909.certs.tar + Machine1f4=f5.test.com.130909.certs.tar + ftp -n -vd 192.168.10.10 Here is what it is showing in the logs: [testuser@F5:Active:In Sync] tmp vi log.bigip Connected to 192.168.10.10 (192.168.10.10). 220 testsrv X2 WS_FTP Server 6.1.1(82011250) ---> SYST 503 Command SYST not accepted during Connected ---> USER testuser 331 Enter password ---> PASS XXXX 230 User logged in ---> TYPE I 200 Transfer mode set to BINARY local: /var/tmp/f5.test.com.130909.ucs remote: f5.test.com.130909.ucs ---> PASV ~
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
