BASH Script to make UCS and FTP off to remote Server
Problem this snippet solves:
Automate UCS Backup and copy via FTP to remote FTP Server.
How to use this snippet:
Run as a script to save and ship off a UCS file, via FTP, from the BIGIP Device to a Remote Server.
Code :
#!/bin/bash # set the date variable TODAY=$(date +'%Y%m%d') # Set FTP Remote Hostname or IP FTPHOST="Your IP" # FTP User name and password USER='Your User' PASSWORD='your password' # ID Hostname for Backup File host="$HOSTNAME" # Used to identify the first 3 letters of the hostname which can be # to separted backups on the remote FTP Server by Site ID or Device ID folder=$(echo $HOSTNAME -s|cut -c 1-3) #run the F5 bigpipe config builder cd /var/local/ucs tmsh save sys ucs /var/local/ucs/$host.ucs #Rename the config.ucs and append the date to the end NUM=0 until [ "$NUM" -eq 5 ] do if [ -f /var/local/ucs/$host.ucs ] then mv $host.ucs $host-$TODAY.ucs ; break else sleep 5 fi NUM=`expr "$NUM" + 1` done [[ ! -f /var/local/ucs/$host-$TODAY.ucs ]] && exit 1 #Open the FTP connection and move the file ftp -inv $FTPHOST <Tested this on version:
12.0
Published Jun 08, 2016
Version 1.0Russell
Nimbostratus
Joined June 13, 2012
Russell
Nimbostratus
Joined June 13, 2012
- SergioPontes_36Nimbostratus
Thanks Russell.
How I can to include certificates and scf files in the backup ?
- KUNAL_JHA_27198NimbostratusNice work with bash