CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Russell
Nimbostratus
Nimbostratus

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
Comments
KUNAL_JHA_27198
Nimbostratus
Nimbostratus
Nice work with bash
SergioPontes_36
Nimbostratus
Nimbostratus

Thanks Russell.

            How I can to include certificates and scf files in the backup ?
Version history
Last update:
‎08-Jun-2016 08:10
Updated by:
Contributors