Forum Discussion

Indrajit_Basak_'s avatar
Indrajit_Basak_
Icon for Nimbostratus rankNimbostratus
Mar 23, 2014

Automatic weekly backup transfer to FTP

Hi , I have configured 00 3 * * * tmsh save /sys ucs /var/ucs/XYZ. ucs in crontab -e and weekly backup is working fine in local . Now I need to schedule automatically transfer to backup files to FTP server .

Got the script from devcentral for FTP transfer

$DATE=

date "+%m_%d_%y"
Here we create the ucs archive tmsh save sys ucs $DATE Here we copy it to your server with scp scp /var/local/ucs/$DATE user@ip_server:path Here we do the same with ftp ftp -n your_server <

Now I am little bit confused where to write this script and how it will relate to cronjob ?? Can anybody help on this .

Regds.....

  • Instead of specifying the tmsh command in crontab, specify a Bash script that 1) performs the tmsh archive, and then 2) FTPs it to the remote destination.

     

  • This is a very minimal Bash script with no error checking, but should give you a good start:

    !/bin/bash
    
    today_ucs="`date "+%m_%d_%y"`.ucs"
    dir=`pwd`
    
    tmsh save /sys ucs $dir/$today_ucs
    
    ftp -n <
    
    
    Give this Bash script a name and reference it in crontab.