Forum Discussion

Cyril's avatar
Cyril
Icon for Nimbostratus rankNimbostratus
Jan 19, 2017

Help! - SCP Automated Backup file using Password

Hello Gentlemen,

I need to push the automated configuration backup files to a Windows server.

I tried this by copying the pub_key on to the destination server where this didn't work as the destination windows server is not supporting key based authentication.

The F5 LTM devices are running on TMOS version 11.4.1

I need to authenticate the destination server with password and I'm not sure if the automation script in place is working as expected, request your assistance.

Thanks for your help in advance!

Please find the code below:

! /bin/bash

 

var1=date

rm /automation/backup/*

devicename=F5LTM01_`date +%F`.ucs

tmsh save /sys ucs /automation/backup/$devicename

scp /automation/backup/$devicename F5Backup@XX.XX.XX.XX:/F5Backup

echo "Back up File copied to the Back Up Server(XX.XX.XX.XX) successfully to /F5Backup/ directory"

 

1 Reply

  • What about backing up to ftp and using something similar to the following:

     

    !/bin/sh -x
    
    tmsh save /sys ucs /var/tmp/LTM_backup
    export a=`date +"%y%m%d"`
    export aa=$HOSTNAME.$a.ucs
    export b=/var/tmp/$aa
    mv /var/tmp/LTM_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
    
    export c=$HOSTNAME.$a.crontab
    export cc=/var/tmp/$c
    cp /etc/crontab $cc
    
    export MName=1.1.1.1
    export Log=/var/tmp/log.bigip
    
    export UserName=SomeUserName
    export UserPassword=SomePassWord
    
    export Machine1f2=$aa
    export Machine1f3=$c
    export Machine1f4=$ff
    
    ftp -nvd ${MName} 14 <<-END 1>&2 > ${Log}
    user ${UserName} ${UserPassword}
    bin
    passive
    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
    

     

    You can then configure a crontab entry and schedule backups for whenever suits you.