Forum Discussion

Ashu_2116's avatar
Ashu_2116
Icon for Nimbostratus rankNimbostratus
Jul 13, 2017

Upload backup files in particular directory on ftp server

Hi We are running LTM on 11.6 I need help in backup script which i copied from below location. https://devcentral.f5.com/wiki/AdvDesignConfig.LTM_Backup_Shell_Script.ashx?lc=1

I have modified backup script according to my requirement & So far the script is working fine and uploading the required files to ftp server. But now i want to upload the backup files in particular directory/folder on ftp server. I could not modify the ftp syntax for same. Can someone please look & help in modifying the syntax for ftp ?

My Script

 !/bin/sh -x
 Name: backup_cron_scriptv11_v1.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: AAG

 Original Date: 07/14/17

tmsh save /sys config file phleh069
export a=`date +"%y%m%d"`
export aa=$HOSTNAME.$a.scf
export b=/var/local/scf/$aa
mv /var/local/scf/phleh069.scf $b

export ff=$HOSTNAME.$a.certs.tar
export f=/var/local/scf/$ff
mv /var/local/scf/phleh069.scf.tar $f

export c=$HOSTNAME.$a.crontab
export cc=/var/tmp/$c
cp /etc/crontab $cc

export MName=172.27.99.33
export Log=/var/tmp/log.bigip

export UserName=admin
export UserPassword=admin123

export Machine1f2=$aa
export Machine1f3=$c
export Machine1f4=$ff

ftp -nvd ${MName/phleh069} <<-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

 Crontab -e

38 16 * * * /etc/cron.daily/backup_cron_scriptv11_v2.sh

 To make the script executable under directory /etc/cron.daily.

chmod 775 "backup_cron_scriptv11_v2.sh"   
No RepliesBe the first to reply