BIG-IP Backup Script In Bash

Problem this snippet solves:

A script that can backup F5 configurations, runs daily, and FTP's the backup to a defined remote server. You will need to change the ftphost, user and password variables to reflect the FTP server you are connecting to as well as change the directory where the script has "cd /F5/JAX1" to reflect the clients directory structure.

Cron job setup

To ensure a daily backup, save the script source below in /etc/cron.daily:

Code :

#!/bin/bash
# set the date variable
today=$(date +'%Y%m%d') 
ftphost="ADD FTP IP HERE"
user="ADD FTP USERNAME HERE"
password="ADD FTP PASSWORD HERE"
#run the F5 bigpipe config builder
cd /
bigpipe config save /config.ucs
#Rename the config.ucs and append the date to the end
NUM=0
until [ "$NUM" -eq 5 ]
do
if [ -f /config.ucs ]
then mv config.ucs config-$today.ucs ; break
else sleep 5
fi
NUM=`expr "$NUM" + 1`
done
[[ ! -f /config-$today.ucs ]] && exit 1
#Open the FTP connection and move the file
ftp -in <
Published Mar 12, 2015
Version 1.0
  • Hello Gurus I'm trying to run this script and getting several errors, here is the output: [root@DEVADC1:Active] cron.daily chmod 775 f5backup.sh [root@DEVADC1:Active] cron.daily . ./f5backup.sh : command not found : No such file or directory Error, invalid characters in UCS file name. The dash, period, forward-slash, plus sign, and underscore are the only special characters allowed. Error during config save. Unexpected Error: UCS saving process failed. bash: ./f5backup.sh: line 32: syntax error: unexpected end of file Any ideas?